diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-03-21 21:40:49 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-03-25 19:17:59 +0100 |
commit | 528a6f8a232c060faf024008e4f8a09b4aa8dabc (patch) | |
tree | 86cac78b7f4d3998bedd923da83145c37ec88ff4 /tests/LinkFilterTest.php | |
parent | ee88a4bcc29da721cf43b750663aebeac4969517 (diff) | |
download | Shaarli-528a6f8a232c060faf024008e4f8a09b4aa8dabc.tar.gz Shaarli-528a6f8a232c060faf024008e4f8a09b4aa8dabc.tar.zst Shaarli-528a6f8a232c060faf024008e4f8a09b4aa8dabc.zip |
Refactor filter in LinkDB
* search type now carried by LinkDB in order to factorize code between different search sources.
* LinkDB->filter split in 3 method: filterSearch, filterHash, filterDay (we know what type of filter is needed).
* filterHash now throw a LinkNotFoundException if it doesn't exist: internal implementation choice, still displays a 404.
* Smallhash regex has been rewritten.
* Unit tests update
Diffstat (limited to 'tests/LinkFilterTest.php')
-rw-r--r-- | tests/LinkFilterTest.php | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/LinkFilterTest.php b/tests/LinkFilterTest.php index f991a9c9..1620bb78 100644 --- a/tests/LinkFilterTest.php +++ b/tests/LinkFilterTest.php | |||
@@ -165,13 +165,12 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase | |||
165 | 165 | ||
166 | /** | 166 | /** |
167 | * No link for this hash | 167 | * No link for this hash |
168 | * | ||
169 | * @expectedException LinkNotFoundException | ||
168 | */ | 170 | */ |
169 | public function testFilterUnknownSmallHash() | 171 | public function testFilterUnknownSmallHash() |
170 | { | 172 | { |
171 | $this->assertEquals( | 173 | self::$linkFilter->filter(LinkFilter::$FILTER_HASH, 'Iblaah'); |
172 | 0, | ||
173 | count(self::$linkFilter->filter(LinkFilter::$FILTER_HASH, 'Iblaah')) | ||
174 | ); | ||
175 | } | 174 | } |
176 | 175 | ||
177 | /** | 176 | /** |