diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-01-20 23:34:33 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-02-15 20:40:39 +0100 |
commit | 21979ff11ceee0042642ac17147858a4155d54c5 (patch) | |
tree | 9527f3dbb2a23e0b42a2f9ce4cc7d4c7580da455 /tests/LinkFilterTest.php | |
parent | 6e607ca613b47e17f7516e94adfee930d4f3e1e8 (diff) | |
download | Shaarli-21979ff11ceee0042642ac17147858a4155d54c5.tar.gz Shaarli-21979ff11ceee0042642ac17147858a4155d54c5.tar.zst Shaarli-21979ff11ceee0042642ac17147858a4155d54c5.zip |
Add exclusion in tag search
* Searching '-mytag' will now exlude all shaares with 'mytag' tag.
* All tags starting with a '-' are renamed without it (through the Updater).
* Unit tests.
Minor code changes:
* LinkDB->filter() can now take no parameters (get all link depending on logged status).
* tagsStrToArray() is now static and filters blank tags.
Diffstat (limited to 'tests/LinkFilterTest.php')
-rw-r--r-- | tests/LinkFilterTest.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/LinkFilterTest.php b/tests/LinkFilterTest.php index 5fb2423f..164af0d4 100644 --- a/tests/LinkFilterTest.php +++ b/tests/LinkFilterTest.php | |||
@@ -254,4 +254,20 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase | |||
254 | count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, 'free software')) | 254 | count(self::$linkFilter->filter(LinkFilter::$FILTER_TEXT, 'free software')) |
255 | ); | 255 | ); |
256 | } | 256 | } |
257 | |||
258 | /** | ||
259 | * Tag search with exclusion. | ||
260 | */ | ||
261 | public function testTagFilterWithExclusion() | ||
262 | { | ||
263 | $this->assertEquals( | ||
264 | 1, | ||
265 | count(self::$linkFilter->filter(LinkFilter::$FILTER_TAG, 'gnu -free')) | ||
266 | ); | ||
267 | |||
268 | $this->assertEquals( | ||
269 | 5, | ||
270 | count(self::$linkFilter->filter(LinkFilter::$FILTER_TAG, '-free')) | ||
271 | ); | ||
272 | } | ||
257 | } | 273 | } |