X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FEntryControllerTest.php;h=12788366d5ce0799e2f7e3dd39c05db9382c5afc;hb=5614df19cf3ed2be9d56853e5441412d4d09cff4;hp=a02f969911f5a1ed44c2341d7f6ab9c22199b726;hpb=300f293cb1b7c2e2a94e3d716c75faf4b2a9b823;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index a02f9699..12788366 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -6,11 +6,12 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\SiteCredential; +use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Helper\ContentProxy; class EntryControllerTest extends WallabagCoreTestCase { - const An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'http://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html'; + const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'http://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html'; public $downloadImagesEnabled = false; public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'; @@ -475,7 +476,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); - $form = $crawler->filter('button[type=submit]')->form(); + $form = $crawler->filter('button[id=entry_save]')->form(); $data = [ 'entry[title]' => 'My updated title hehe :)', @@ -508,7 +509,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); - $form = $crawler->filter('button[type=submit]')->form(); + $form = $crawler->filter('button[id=entry_save]')->form(); $data = [ 'entry[title]' => 'My updated title hehe :)', @@ -1018,7 +1019,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); - $url = self::An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE; + $url = self::AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE; $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); $crawler = $client->request('GET', '/new'); @@ -1060,7 +1061,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); - $url = self::An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE; + $url = self::AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE; $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); $crawler = $client->request('GET', '/new'); @@ -1478,4 +1479,23 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame('email_tracking.pdf', $content->getTitle()); $this->assertSame('example.com', $content->getDomainName()); } + + public function testEntryDeleteTagLink() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + $entry = $em->getRepository('WallabagCoreBundle:Entry')->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); + $tag = $entry->getTags()[0]; + + $crawler = $client->request('GET', '/view/' . $entry->getId()); + + // As long as the deletion link of a tag is following + // a link to the tag view, we take the second one to retrieve + // the deletion link of the first tag + $link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract('href')[1]; + + $this->assertSame(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link); + } }