]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/utils/ReferenceLinkDB.php
3 * Populates a reference datastore to test LinkDB
7 public static $NB_LINKS_TOTAL = 7;
9 private $_links = array();
10 private $_publicCount = 0;
11 private $_privateCount = 0;
14 * Populates the test DB with reference data
16 public function __construct()
19 'Link title: @website',
21 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this. #hashtag',
28 'Free as in Freedom 2.0 @website',
29 'https://static.fsf.org/nosvn/faif-2.0.pdf',
30 'Richard Stallman and the Free Software Revolution. Read this. #hashtag',
33 'free gnu software stallman -exclude stuff hashtag',
39 'http://mediagoblin.org/',
40 'A free software media publishing platform #hashtagOther',
43 'gnu media web .hidden hashtag'
47 'w3c-markup-validator',
48 'https://dvcs.w3.org/hg/markup-validator/summary',
49 'Mercurial repository for the W3C Validator #private',
52 'css html w3c web Mercurial'
56 'UserFriendly - Web Designer',
57 'http://ars.userfriendly.org/cartoons/?id=20121206',
58 'Naming conventions... #private',
65 'UserFriendly - Samba',
66 'http://ars.userfriendly.org/cartoons/?id=20010306',
75 'http://geek-and-poke.com/',
79 'dev cartoon tag1 tag2 tag3 tag4 '
86 protected function addLink($title, $url, $description, $private, $date, $tags, $updated = '')
91 'description' => $description,
92 'private' => $private,
95 'updated' => $updated,
97 $this->_links
[$date] = $link;
100 $this->_privateCount++
;
103 $this->_publicCount++
;
107 * Writes data to the datastore
109 public function write($filename)
113 '<?php /* '.base64_encode(gzdeflate(serialize($this->_links
))).' */ ?>'
118 * Returns the number of links in the reference data
120 public function countLinks()
122 return $this->_publicCount +
$this->_privateCount
;
126 * Returns the number of public links in the reference data
128 public function countPublicLinks()
130 return $this->_publicCount
;
134 * Returns the number of private links in the reference data
136 public function countPrivateLinks()
138 return $this->_privateCount
;
141 public function getLinks()
143 return $this->_links
;