aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2015-12-28 13:51:48 +0100
committerNicolas Lœuillet <nicolas@loeuillet.org>2015-12-28 13:51:48 +0100
commitc997cfcc9c161241a6398b0942a1a869688d807a (patch)
tree42c40d24baab371f5dd41eda12d3cbdbe6445a51 /src/Wallabag/CoreBundle/Tests
parentd25b8288216a09fa5cf7f40e614c133a6edd8a67 (diff)
parent2863bf2ab58a4903128f60751aa416130db93e52 (diff)
downloadwallabag-c997cfcc9c161241a6398b0942a1a869688d807a.tar.gz
wallabag-c997cfcc9c161241a6398b0942a1a869688d807a.tar.zst
wallabag-c997cfcc9c161241a6398b0942a1a869688d807a.zip
Merge pull request #1540 from wallabag/v2-fix-delete
v2 – Don't redirect to the content page after deletion
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index af62aee8..9f585d85 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -3,6 +3,7 @@
3namespace Wallabag\CoreBundle\Tests\Controller; 3namespace Wallabag\CoreBundle\Tests\Controller;
4 4
5use Wallabag\CoreBundle\Tests\WallabagCoreTestCase; 5use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
6use Wallabag\CoreBundle\Entity\Entry;
6 7
7class EntryControllerTest extends WallabagCoreTestCase 8class EntryControllerTest extends WallabagCoreTestCase
8{ 9{
@@ -290,6 +291,51 @@ class EntryControllerTest extends WallabagCoreTestCase
290 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 291 $this->assertEquals(404, $client->getResponse()->getStatusCode());
291 } 292 }
292 293
294 /**
295 * It will create a new entry.
296 * Browse to it.
297 * Then remove it.
298 *
299 * And it'll check that user won't be redirected to the view page of the content when it had been removed
300 */
301 public function testViewAndDelete()
302 {
303 $this->logInAs('admin');
304 $client = $this->getClient();
305
306 // add a new content to be removed later
307 $user = $client->getContainer()
308 ->get('doctrine.orm.entity_manager')
309 ->getRepository('WallabagUserBundle:User')
310 ->findOneByUserName('admin');
311
312 $content = new Entry($user);
313 $content->setUrl('http://1.1.1.1/entry');
314 $content->setReadingTime(12);
315 $content->setDomainName('domain.io');
316 $content->setMimetype('text/html');
317 $content->setTitle('test title entry');
318 $content->setContent('This is my content /o/');
319 $content->setArchived(true);
320 $content->setLanguage('fr');
321
322 $client->getContainer()
323 ->get('doctrine.orm.entity_manager')
324 ->persist($content);
325 $client->getContainer()
326 ->get('doctrine.orm.entity_manager')
327 ->flush();
328
329 $client->request('GET', '/view/'.$content->getId());
330 $this->assertEquals(200, $client->getResponse()->getStatusCode());
331
332 $client->request('GET', '/delete/'.$content->getId());
333 $this->assertEquals(302, $client->getResponse()->getStatusCode());
334
335 $client->followRedirect();
336 $this->assertEquals(200, $client->getResponse()->getStatusCode());
337 }
338
293 public function testViewOtherUserEntry() 339 public function testViewOtherUserEntry()
294 { 340 {
295 $this->logInAs('admin'); 341 $this->logInAs('admin');