X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FLinkDBTest.php;h=31306069853b1b31820aa1c7388755e5293ee85f;hb=e1fd94b545a6783853eeee03264596111fdf767e;hp=8ffb1512db922b33350f4b5be5c3d2a15446fdc1;hpb=b1eb5d1d31e3ea256501c08a3ed9aa7183b27466;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 8ffb1512..31306069 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -101,7 +101,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase * Attempt to instantiate a LinkDB whereas the datastore is not writable * * @expectedException IOException - * @expectedExceptionMessageRegExp /Error accessing null/ + * @expectedExceptionMessageRegExp /Error accessing\nnull/ */ public function testConstructDatastoreNotWriteable() { @@ -256,7 +256,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); $this->assertNotEquals(false, $link); - $this->assertEquals( + $this->assertContains( 'A free software media publishing platform', $link['description'] ); @@ -293,6 +293,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase // The DB contains a link with `sTuff` and another one with `stuff` tag. // They need to be grouped with the first case found (`sTuff`). 'sTuff' => 2, + 'hashtag' => 2, ), self::$publicLinkDB->allTags() ); @@ -315,6 +316,11 @@ class LinkDBTest extends PHPUnit_Framework_TestCase 'sTuff' => 2, '-exclude' => 1, '.hidden' => 1, + 'hashtag' => 2, + 'tag1' => 1, + 'tag2' => 1, + 'tag3' => 1, + 'tag4' => 1, ), self::$privateLinkDB->allTags() ); @@ -340,6 +346,13 @@ class LinkDBTest extends PHPUnit_Framework_TestCase $db = new LinkDB(self::$testDatastore, false, false, $redirector); foreach($db as $link) { $this->assertStringStartsWith($redirector, $link['real_url']); + $this->assertNotFalse(strpos($link['real_url'], urlencode('://'))); + } + + $db = new LinkDB(self::$testDatastore, false, false, $redirector, false); + foreach($db as $link) { + $this->assertStringStartsWith($redirector, $link['real_url']); + $this->assertFalse(strpos($link['real_url'], urlencode('://'))); } }