]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/utils/ReferenceLinkDB.php
3 * Populates a reference datastore to test LinkDB
7 private $_links = array();
8 private $_publicCount = 0;
9 private $_privateCount = 0;
12 * Populates the test DB with reference data
14 function __construct()
17 'Free as in Freedom 2.0 @website',
18 'https://static.fsf.org/nosvn/faif-2.0.pdf',
19 'Richard Stallman and the Free Software Revolution. Read this.',
22 'free gnu software stallman -exclude stuff'
26 'Link title: @website',
28 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this.',
36 'http://mediagoblin.org/',
37 'A free software media publishing platform',
40 'gnu media web .hidden'
44 'w3c-markup-validator',
45 'https://dvcs.w3.org/hg/markup-validator/summary',
46 'Mercurial repository for the W3C Validator',
49 'css html w3c web Mercurial'
53 'UserFriendly - Web Designer',
54 'http://ars.userfriendly.org/cartoons/?id=20121206',
55 'Naming conventions...',
62 'UserFriendly - Samba',
63 'http://ars.userfriendly.org/cartoons/?id=20010306',
72 'http://geek-and-poke.com/',
83 protected function addLink($title, $url, $description, $private, $date, $tags)
88 'description' => $description,
89 'private' => $private,
93 $this->_links
[$date] = $link;
96 $this->_privateCount++
;
99 $this->_publicCount++
;
103 * Writes data to the datastore
105 public function write($filename)
109 '<?php /* '.base64_encode(gzdeflate(serialize($this->_links
))).' */ ?>'
114 * Returns the number of links in the reference data
116 public function countLinks()
118 return $this->_publicCount +
$this->_privateCount
;
122 * Returns the number of public links in the reference data
124 public function countPublicLinks()
126 return $this->_publicCount
;
130 * Returns the number of private links in the reference data
132 public function countPrivateLinks()
134 return $this->_privateCount
;
137 public function getLinks()
139 return $this->_links
;