diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
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 | |||
109 | $this->assertContains($content->getTitle(), $client->getResponse()->getContent()); | 109 | $this->assertContains($content->getTitle(), $client->getResponse()->getContent()); |
110 | } | 110 | } |
111 | 111 | ||
112 | public function testEdit() | ||
113 | { | ||
114 | $this->logInAs('admin'); | ||
115 | $client = $this->getClient(); | ||
116 | |||
117 | $content = $client->getContainer() | ||
118 | ->get('doctrine.orm.entity_manager') | ||
119 | ->getRepository('WallabagCoreBundle:Entry') | ||
120 | ->findOneByIsArchived(false); | ||
121 | |||
122 | $crawler = $client->request('GET', '/edit/'.$content->getId()); | ||
123 | |||
124 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
125 | |||
126 | $this->assertCount(1, $crawler->filter('input[id=entry_title]')); | ||
127 | $this->assertCount(1, $crawler->filter('button[id=entry_save]')); | ||
128 | } | ||
129 | |||
130 | public function testEditUpdate() | ||
131 | { | ||
132 | $this->logInAs('admin'); | ||
133 | $client = $this->getClient(); | ||
134 | |||
135 | $content = $client->getContainer() | ||
136 | ->get('doctrine.orm.entity_manager') | ||
137 | ->getRepository('WallabagCoreBundle:Entry') | ||
138 | ->findOneByIsArchived(false); | ||
139 | |||
140 | $crawler = $client->request('GET', '/edit/'.$content->getId()); | ||
141 | |||
142 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
143 | |||
144 | $form = $crawler->filter('button[type=submit]')->form(); | ||
145 | |||
146 | $data = array( | ||
147 | 'entry[title]' => 'My updated title hehe :)', | ||
148 | ); | ||
149 | |||
150 | $client->submit($form, $data); | ||
151 | |||
152 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
153 | |||
154 | $crawler = $client->followRedirect(); | ||
155 | |||
156 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text'))); | ||
157 | $this->assertContains('My updated title hehe :)', $alert[0]); | ||
158 | } | ||
159 | |||
112 | public function testToggleArchive() | 160 | public function testToggleArchive() |
113 | { | 161 | { |
114 | $this->logInAs('admin'); | 162 | $this->logInAs('admin'); |