aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php43
1 files changed, 41 insertions, 2 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 6e806553..4ac4548b 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -137,6 +137,8 @@ class EntryControllerTest extends WallabagCoreTestCase
137 $this->logInAs('admin'); 137 $this->logInAs('admin');
138 $client = $this->getClient(); 138 $client = $this->getClient();
139 139
140 $client->getContainer()->get('craue_config')->set('store_article_headers', 1);
141
140 $crawler = $client->request('GET', '/new'); 142 $crawler = $client->request('GET', '/new');
141 143
142 $this->assertSame(200, $client->getResponse()->getStatusCode()); 144 $this->assertSame(200, $client->getResponse()->getStatusCode());
@@ -165,6 +167,7 @@ class EntryControllerTest extends WallabagCoreTestCase
165 $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s')); 167 $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s'));
166 $this->assertSame('Morgane Tual', $author[0]); 168 $this->assertSame('Morgane Tual', $author[0]);
167 $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); 169 $this->assertArrayHasKey('x-varnish1', $content->getHeaders());
170 $client->getContainer()->get('craue_config')->set('store_article_headers', 0);
168 } 171 }
169 172
170 public function testPostWithMultipleAuthors() 173 public function testPostWithMultipleAuthors()
@@ -475,6 +478,40 @@ class EntryControllerTest extends WallabagCoreTestCase
475 478
476 $data = [ 479 $data = [
477 'entry[title]' => 'My updated title hehe :)', 480 'entry[title]' => 'My updated title hehe :)',
481 'entry[origin_url]' => 'https://example.io',
482 ];
483
484 $client->submit($form, $data);
485
486 $this->assertSame(302, $client->getResponse()->getStatusCode());
487
488 $crawler = $client->followRedirect();
489
490 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
491 $this->assertContains('My updated title hehe :)', $title[0]);
492 $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']));
493 $this->assertContains('example.io', trim($stats[1]));
494 }
495
496 public function testEditRemoveOriginUrl()
497 {
498 $this->logInAs('admin');
499 $client = $this->getClient();
500
501 $entry = new Entry($this->getLoggedInUser());
502 $entry->setUrl($this->url);
503 $this->getEntityManager()->persist($entry);
504 $this->getEntityManager()->flush();
505
506 $crawler = $client->request('GET', '/edit/' . $entry->getId());
507
508 $this->assertSame(200, $client->getResponse()->getStatusCode());
509
510 $form = $crawler->filter('button[type=submit]')->form();
511
512 $data = [
513 'entry[title]' => 'My updated title hehe :)',
514 'entry[origin_url]' => '',
478 ]; 515 ];
479 516
480 $client->submit($form, $data); 517 $client->submit($form, $data);
@@ -483,8 +520,10 @@ class EntryControllerTest extends WallabagCoreTestCase
483 520
484 $crawler = $client->followRedirect(); 521 $crawler = $client->followRedirect();
485 522
486 $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); 523 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
487 $this->assertContains('My updated title hehe :)', $alert[0]); 524 $this->assertContains('My updated title hehe :)', $title[0]);
525 $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
526 $this->assertNotContains('example.io', trim($stats[0]));
488 } 527 }
489 528
490 public function testToggleArchive() 529 public function testToggleArchive()