diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 46956f2..e413928 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -429,4 +429,30 @@ class LinkDBTest extends PHPUnit_Framework_TestCase { self::$publicLinkDB->filterHash(''); } + + /** + * test whitespace handling in tags. + * split on whitespace runs and don't allow empty tags. + */ + public function testReadTagsWithWhitespace() + { + // test load contains "tags": " tag1 tag2 tag3 tag4 " + $ds = ''; + file_put_contents(self::$testDatastore, $ds); + self::$publicLinkDB = new LinkDB(self::$testDatastore, false, false); + + $this->assertEquals( + array( + 'tag1' => 1, + 'tag2' => 1, + 'tag3' => 1, + 'tag4' => 1 + ), + self::$publicLinkDB->allTags() + ); + } }