X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FEntryControllerTest.php;h=006ca330564a7413ed3eafa283f0f71533cc221e;hb=b878be4cc99fd4927c70b59386cf7a57b33bb381;hp=6721b2e4175c3c7305e2924046e7dc8e822ea8e4;hpb=72efc80fdc919656cf50a0432eec1ba58fda0ef2;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 6721b2e4..006ca330 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -166,15 +166,14 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame($this->url, $content->getUrl()); $this->assertContains('Google', $content->getTitle()); $this->assertSame('fr', $content->getLanguage()); - $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s')); - $this->assertSame('Morgane Tual', $author[0]); - $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); + $this->assertSame('2016-04-07 19:01:35', $content->getPublishedAt()->format('Y-m-d H:i:s')); + $this->assertArrayHasKey('x-frame-options', $content->getHeaders()); $client->getContainer()->get('craue_config')->set('store_article_headers', 0); } public function testPostWithMultipleAuthors() { - $url = 'http://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768'; + $url = 'https://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768'; $this->logInAs('admin'); $client = $this->getClient(); @@ -197,6 +196,7 @@ class EntryControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->findByUrlAndUserId($url, $this->getLoggedInUserId()); + $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); $authors = $content->getPublishedBy(); $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); $this->assertSame('fr', $content->getLanguage()); @@ -524,7 +524,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); $this->assertContains('My updated title hehe :)', $title[0]); - $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']))); + $this->assertSame(1, \count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']))); $this->assertNotContains('example.io', trim($stats[0])); } @@ -620,7 +620,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content->setMimetype('text/html'); $content->setTitle('test title entry'); $content->setContent('This is my content /o/'); - $content->setArchived(true); + $content->updateArchived(true); $content->setLanguage('fr'); $em->persist($content); @@ -773,7 +773,7 @@ class EntryControllerTest extends WallabagCoreTestCase $entry = new Entry($this->getLoggedInUser()); $entry->setUrl($this->url); - $entry->setArchived(false); + $entry->updateArchived(false); $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); @@ -984,8 +984,13 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/share/' . $content->getId()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - // follow link with uid - $crawler = $client->followRedirect(); + $shareUrl = $client->getResponse()->getTargetUrl(); + + // use a new client to have a fresh empty session (instead of a logged one from the previous client) + $client->restart(); + + $client->request('GET', $shareUrl); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); @@ -1001,9 +1006,6 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/share/' . $content->getUid()); $this->assertSame(404, $client->getResponse()->getStatusCode()); - $client->request('GET', '/view/' . $content->getId()); - $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); - // removing the share $client->request('GET', '/share/delete/' . $content->getId()); $this->assertSame(302, $client->getResponse()->getStatusCode()); @@ -1244,7 +1246,7 @@ class EntryControllerTest extends WallabagCoreTestCase $entry = new Entry($this->getLoggedInUser()); $entry->setUrl('http://0.0.0.0/foo/baz/qux'); $entry->setTitle('Le manège'); - $entry->setArchived(true); + $entry->updateArchived(true); $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); @@ -1274,7 +1276,7 @@ class EntryControllerTest extends WallabagCoreTestCase $entry = new Entry($this->getLoggedInUser()); $entry->setUrl('http://domain/qux'); $entry->setTitle('Le manège'); - $entry->setArchived(true); + $entry->updateArchived(true); $this->getEntityManager()->persist($entry); $this->getEntityManager()->flush(); @@ -1325,12 +1327,12 @@ class EntryControllerTest extends WallabagCoreTestCase 'http://www.hao123.com/shequ?__noscript__-=1', 'zh_CN', ], - 'ru_RU' => [ - 'http://netler.ru/ikt/windows-error-reporting.htm', - 'ru_RU', + 'ru' => [ + 'https://www.kp.ru/daily/26879.7/3921982/', + 'ru', ], 'pt_BR' => [ - 'http://precodoscombustiveis.com.br/postos/cidade/4121/pr/maringa', + 'https://politica.estadao.com.br/noticias/eleicoes,campanha-catatonica,70002491983', 'pt_BR', ], 'fucked_list_of_languages' => [