From 958671a7ae2f19c4b919ed4ba0161e7d300411b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Fri, 13 Nov 2015 21:23:39 +0100 Subject: Add a quick test --- .../Tests/Controller/EntryControllerTest.php | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 56b4c9e4..9f2bcd6c 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -102,6 +102,41 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertContains('Google', $alert[0]); } + /** + * This test will require an internet connection. + */ + public function testPostNewThatWillBeTaggued() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/new'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('button[type=submit]')->form(); + + $data = array( + 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', + ); + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->followRedirect(); + + $em = $client->getContainer() + ->get('doctrine.orm.entity_manager'); + $entry = $em + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByUrl($url); + $this->assertCount(1, $entry->getTags()); + + $em->remove($entry); + $em->flush(); + } + public function testArchive() { $this->logInAs('admin'); -- cgit v1.2.3 From 69edb774eb360ea33646fcc81cd4ea71fa137680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Mon, 16 Nov 2015 13:34:00 +0100 Subject: Assert that the tag has is the good one --- src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 9f2bcd6c..af62aee8 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -131,7 +131,10 @@ class EntryControllerTest extends WallabagCoreTestCase $entry = $em ->getRepository('WallabagCoreBundle:Entry') ->findOneByUrl($url); - $this->assertCount(1, $entry->getTags()); + $tags = $entry->getTags(); + + $this->assertCount(1, $tags); + $this->assertEquals('wallabag', $tags[0]->getLabel()); $em->remove($entry); $em->flush(); -- cgit v1.2.3