aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/utils
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-25 15:54:20 +0200
committerGitHub <noreply@github.com>2017-05-25 15:54:20 +0200
commit3e395a6bc63cba16b0772a382f6cbac0ce4ab906 (patch)
tree220eaf3400aeeea821b7e150855a1d44f1b5bfe9 /tests/utils
parentb2e2aa42e288e0becaa95bf9cc3be679743fc98e (diff)
parent7d86f40bdb2135655b5b4fe8cbcc1ac102114f86 (diff)
downloadShaarli-3e395a6bc63cba16b0772a382f6cbac0ce4ab906.tar.gz
Shaarli-3e395a6bc63cba16b0772a382f6cbac0ce4ab906.tar.zst
Shaarli-3e395a6bc63cba16b0772a382f6cbac0ce4ab906.zip
Merge pull request #841 from ArthurHoaro/feature/search-no-tag
Empty tag search will look for not tagged links
Diffstat (limited to 'tests/utils')
-rw-r--r--tests/utils/ReferenceLinkDB.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php
index 1f4b3063..f09eebc1 100644
--- a/tests/utils/ReferenceLinkDB.php
+++ b/tests/utils/ReferenceLinkDB.php
@@ -4,7 +4,7 @@
4 */ 4 */
5class ReferenceLinkDB 5class ReferenceLinkDB
6{ 6{
7 public static $NB_LINKS_TOTAL = 8; 7 public static $NB_LINKS_TOTAL = 9;
8 8
9 private $_links = array(); 9 private $_links = array();
10 private $_publicCount = 0; 10 private $_publicCount = 0;
@@ -38,6 +38,16 @@ class ReferenceLinkDB
38 ); 38 );
39 39
40 $this->addLink( 40 $this->addLink(
41 9,
42 'PSR-2: Coding Style Guide',
43 'http://www.php-fig.org/psr/psr-2/',
44 'This guide extends and expands on PSR-1, the basic coding standard.',
45 0,
46 DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_152312'),
47 ''
48 );
49
50 $this->addLink(
41 8, 51 8,
42 'Free as in Freedom 2.0 @website', 52 'Free as in Freedom 2.0 @website',
43 'https://static.fsf.org/nosvn/faif-2.0.pdf', 53 'https://static.fsf.org/nosvn/faif-2.0.pdf',
@@ -161,6 +171,20 @@ class ReferenceLinkDB
161 return $this->_privateCount; 171 return $this->_privateCount;
162 } 172 }
163 173
174 /**
175 * Returns the number of links without tag
176 */
177 public function countUntaggedLinks()
178 {
179 $cpt = 0;
180 foreach ($this->_links as $link) {
181 if (empty($link['tags'])) {
182 ++$cpt;
183 }
184 }
185 return $cpt;
186 }
187
164 public function getLinks() 188 public function getLinks()
165 { 189 {
166 return $this->_links; 190 return $this->_links;