From 82d6d9cb06a1486e2e3b05fa6ce857b3b8655180 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 2 Jun 2015 18:54:34 +0200 Subject: Add basic title edition Fix #218 I mean basic, because there is no javascript at all. It could be a nice edit-in-place. But for the moment, it is simple. --- .../Tests/Controller/EntryControllerTest.php | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/Wallabag/CoreBundle/Tests') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 8a7fdda2..904e2a5c 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -109,6 +109,54 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertContains($content->getTitle(), $client->getResponse()->getContent()); } + public function testEdit() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByIsArchived(false); + + $crawler = $client->request('GET', '/edit/'.$content->getId()); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $this->assertCount(1, $crawler->filter('input[id=entry_title]')); + $this->assertCount(1, $crawler->filter('button[id=entry_save]')); + } + + public function testEditUpdate() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByIsArchived(false); + + $crawler = $client->request('GET', '/edit/'.$content->getId()); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('button[type=submit]')->form(); + + $data = array( + 'entry[title]' => 'My updated title hehe :)', + ); + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->followRedirect(); + + $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text'))); + $this->assertContains('My updated title hehe :)', $alert[0]); + } + public function testToggleArchive() { $this->logInAs('admin'); -- cgit v1.2.3