aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-05-31 11:31:16 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-05-31 11:31:16 +0200
commitf329e769fd7795f408643735edccb4dc4215c900 (patch)
treeed8f64c94c65fa2f8a40dffd6457d8bcd926f7dd /src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
parent839475776bdacf7e939984ee8230cb84d34c2289 (diff)
parent3be047456d6f91d8ef5404c9c7698e0d1f9a057d (diff)
downloadwallabag-f329e769fd7795f408643735edccb4dc4215c900.tar.gz
wallabag-f329e769fd7795f408643735edccb4dc4215c900.tar.zst
wallabag-f329e769fd7795f408643735edccb4dc4215c900.zip
Merge pull request #2122 from wallabag/fix-tags-deletion
Fix the deletion of Tags/Entries relation when delete an entry
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index c7087a71..5ce893c1 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -163,7 +163,7 @@ class EntryControllerTest extends WallabagCoreTestCase
163 /** 163 /**
164 * This test will require an internet connection. 164 * This test will require an internet connection.
165 */ 165 */
166 public function testPostNewThatWillBeTaggued() 166 public function testPostNewThatWillBeTagged()
167 { 167 {
168 $this->logInAs('admin'); 168 $this->logInAs('admin');
169 $client = $this->getClient(); 169 $client = $this->getClient();
@@ -181,8 +181,7 @@ class EntryControllerTest extends WallabagCoreTestCase
181 $client->submit($form, $data); 181 $client->submit($form, $data);
182 182
183 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 183 $this->assertEquals(302, $client->getResponse()->getStatusCode());
184 184 $this->assertContains('/', $client->getResponse()->getTargetUrl());
185 $client->followRedirect();
186 185
187 $em = $client->getContainer() 186 $em = $client->getContainer()
188 ->get('doctrine.orm.entity_manager'); 187 ->get('doctrine.orm.entity_manager');
@@ -196,6 +195,35 @@ class EntryControllerTest extends WallabagCoreTestCase
196 195
197 $em->remove($entry); 196 $em->remove($entry);
198 $em->flush(); 197 $em->flush();
198
199 // and now re-submit it to test the cascade persistence for tags after entry removal
200 // related https://github.com/wallabag/wallabag/issues/2121
201 $crawler = $client->request('GET', '/new');
202
203 $this->assertEquals(200, $client->getResponse()->getStatusCode());
204
205 $form = $crawler->filter('form[name=entry]')->form();
206
207 $data = [
208 'entry[url]' => $url = 'https://github.com/wallabag/wallabag/tree/master',
209 ];
210
211 $client->submit($form, $data);
212
213 $this->assertEquals(302, $client->getResponse()->getStatusCode());
214 $this->assertContains('/', $client->getResponse()->getTargetUrl());
215
216 $entry = $em
217 ->getRepository('WallabagCoreBundle:Entry')
218 ->findOneByUrl($url);
219
220 $tags = $entry->getTags();
221
222 $this->assertCount(1, $tags);
223 $this->assertEquals('wallabag', $tags[0]->getLabel());
224
225 $em->remove($entry);
226 $em->flush();
199 } 227 }
200 228
201 public function testArchive() 229 public function testArchive()