X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FConfigControllerTest.php;h=8f2ca1cb3954c44f4c3610958028fbf996ac7d54;hb=273b6f06584092f3b596406bf4c0d57aa738e8bf;hp=a28c3b6bb7be53c8baae35d35822c217a371ad76;hpb=5066c3e066ad67788bdf6edac9e80cab614a2d4d;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index a28c3b6b..8f2ca1cb 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -1,6 +1,6 @@ logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/config'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('button[id=tagging_rule_save]')->form(); + + $crawler = $client->submit($form, [ + 'tagging_rule[rule]' => str_repeat('title', 60), + 'tagging_rule[tags]' => 'cool tag', + ]); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + + $this->assertContains('255 characters', $body[0]); + } + public function testDeletingTaggingRuleFromAnOtherUser() { $this->logInAs('bob'); @@ -775,7 +798,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') - ->countAllEntriesByUsername($user->getId()); + ->countAllEntriesByUser($user->getId()); $this->assertEquals(0, $entryReset, 'Entries were reset'); } @@ -820,7 +843,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $entryReset = $em ->getRepository('WallabagCoreBundle:Entry') - ->countAllEntriesByUsername($user->getId()); + ->countAllEntriesByUser($user->getId()); $this->assertEquals(0, $entryReset, 'Entries were reset'); @@ -836,4 +859,23 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertEmpty($annotationsReset, 'Annotations were reset'); } + + public function testSwitchViewMode() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $client->request('GET', '/unread/list'); + + $this->assertNotContains('listmode', $client->getResponse()->getContent()); + + $client->request('GET', '/config/view-mode'); + $crawler = $client->followRedirect(); + + $client->request('GET', '/unread/list'); + + $this->assertContains('listmode', $client->getResponse()->getContent()); + + $client->request('GET', '/config/view-mode'); + } }