X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FEntryControllerTest.php;h=28291b5a029825b49012e0bb6bcd160c77331e09;hb=3527c300215e6e6010efb8bb840b8b6f5c63a1cc;hp=006ca330564a7413ed3eafa283f0f71533cc221e;hpb=b878be4cc99fd4927c70b59386cf7a57b33bb381;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 006ca330..28291b5a 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -522,9 +522,12 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); + $title = $crawler->filter('div[id=article] h1')->extract(['_text']); + $this->assertGreaterThan(1, $title); $this->assertContains('My updated title hehe :)', $title[0]); - $this->assertSame(1, \count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']))); + + $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']); + $this->assertCount(1, $stats); $this->assertNotContains('example.io', trim($stats[0])); } @@ -1327,10 +1330,6 @@ class EntryControllerTest extends WallabagCoreTestCase 'http://www.hao123.com/shequ?__noscript__-=1', 'zh_CN', ], - 'ru' => [ - 'https://www.kp.ru/daily/26879.7/3921982/', - 'ru', - ], 'pt_BR' => [ 'https://politica.estadao.com.br/noticias/eleicoes,campanha-catatonica,70002491983', 'pt_BR', @@ -1496,4 +1495,30 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link); } + + public function testRandom() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $client->request('GET', '/unread/random'); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Unread random'); + + $client->request('GET', '/starred/random'); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Starred random'); + + $client->request('GET', '/archive/random'); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Archive random'); + + $client->request('GET', '/untagged/random'); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random'); + + $client->request('GET', '/all/random'); + $this->assertSame(302, $client->getResponse()->getStatusCode()); + $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'All random'); + } }