]>
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 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'
38 'http://mediagoblin.org/',
39 'A free software media publishing platform #hashtagOther',
42 'gnu media web .hidden hashtag'
46 'w3c-markup-validator',
47 'https://dvcs.w3.org/hg/markup-validator/summary',
48 'Mercurial repository for the W3C Validator #private',
51 'css html w3c web Mercurial'
55 'UserFriendly - Web Designer',
56 'http://ars.userfriendly.org/cartoons/?id=20121206',
57 'Naming conventions... #private',
64 'UserFriendly - Samba',
65 'http://ars.userfriendly.org/cartoons/?id=20010306',
74 'http://geek-and-poke.com/',
85 protected function addLink($title, $url, $description, $private, $date, $tags)
90 'description' => $description,
91 'private' => $private,
95 $this->_links
[$date] = $link;
98 $this->_privateCount++
;
101 $this->_publicCount++
;
105 * Writes data to the datastore
107 public function write($filename)
111 '<?php /* '.base64_encode(gzdeflate(serialize($this->_links
))).' */ ?>'
116 * Returns the number of links in the reference data
118 public function countLinks()
120 return $this->_publicCount +
$this->_privateCount
;
124 * Returns the number of public links in the reference data
126 public function countPublicLinks()
128 return $this->_publicCount
;
132 * Returns the number of private links in the reference data
134 public function countPrivateLinks()
136 return $this->_privateCount
;
139 public function getLinks()
141 return $this->_links
;