X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=tests%2FWallabag%2FCoreBundle%2FController%2FEntryControllerTest.php;h=9b03a5193d1c7b8edb6d660f0cb021336061f663;hb=e4cf672ccf61689ba28c2e89fc55f83167800b18;hp=c40e10a50041135efd2b49af3ba57edba2e8adda;hpb=ab809de18415a9ce3bbc95d3a0a1af6c50a41c4f;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index c40e10a5..9b03a519 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -341,22 +341,23 @@ class EntryControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); - $content = $client->getContainer() - ->get('doctrine.orm.entity_manager') + $em = $client->getContainer() + ->get('doctrine.orm.entity_manager'); + + $content = $em ->getRepository('WallabagCoreBundle:Entry') ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); // empty content $content->setContent(''); - $client->getContainer()->get('doctrine.orm.entity_manager')->persist($content); - $client->getContainer()->get('doctrine.orm.entity_manager')->flush(); + $em->persist($content); + $em->flush(); $client->request('GET', '/reload/'.$content->getId()); $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $content = $client->getContainer() - ->get('doctrine.orm.entity_manager') + $content = $em ->getRepository('WallabagCoreBundle:Entry') ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); @@ -486,9 +487,11 @@ class EntryControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); + $em = $client->getContainer() + ->get('doctrine.orm.entity_manager'); + // add a new content to be removed later - $user = $client->getContainer() - ->get('doctrine.orm.entity_manager') + $user = $em ->getRepository('WallabagUserBundle:User') ->findOneByUserName('admin'); @@ -502,12 +505,8 @@ class EntryControllerTest extends WallabagCoreTestCase $content->setArchived(true); $content->setLanguage('fr'); - $client->getContainer() - ->get('doctrine.orm.entity_manager') - ->persist($content); - $client->getContainer() - ->get('doctrine.orm.entity_manager') - ->flush(); + $em->persist($content); + $em->flush(); $client->request('GET', '/view/'.$content->getId()); $this->assertEquals(200, $client->getResponse()->getStatusCode()); @@ -753,7 +752,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertCount(2, $crawler->filter('div[class=entry]')); } - public function testCache() + public function testShareEntryPublicly() { $this->logInAs('admin'); $client = $this->getClient(); @@ -778,6 +777,10 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); + $this->assertContains('og:title', $client->getResponse()->getContent()); + $this->assertContains('og:type', $client->getResponse()->getContent()); + $this->assertContains('og:url', $client->getResponse()->getContent()); + $this->assertContains('og:image', $client->getResponse()->getContent()); // sharing is now disabled $client->getContainer()->get('craue_config')->set('share_public', 0);