aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2017-11-19 14:50:21 +0100
committerKevin Decherf <kevin@kdecherf.com>2017-11-19 15:02:11 +0100
commit97444566db31c287103468ee64e2b234d223a354 (patch)
treecbeb8904db647fe7d0c184bdfce3a899b081aaa4 /tests
parentecf41ab3fa98884b947d46b71a1f8fc66fddd97d (diff)
downloadwallabag-97444566db31c287103468ee64e2b234d223a354.tar.gz
wallabag-97444566db31c287103468ee64e2b234d223a354.tar.zst
wallabag-97444566db31c287103468ee64e2b234d223a354.zip
Update EntryControllerTest to handle origin_url
Set an origin_url in testEditUpdate Test origin_url deletion in testEditRemoveOriginUrl Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php40
1 files changed, 38 insertions, 2 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 6e806553..e2fb8d78 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -475,6 +475,7 @@ class EntryControllerTest extends WallabagCoreTestCase
475 475
476 $data = [ 476 $data = [
477 'entry[title]' => 'My updated title hehe :)', 477 'entry[title]' => 'My updated title hehe :)',
478 'entry[origin_url]' => 'https://example.io',
478 ]; 479 ];
479 480
480 $client->submit($form, $data); 481 $client->submit($form, $data);
@@ -483,8 +484,43 @@ class EntryControllerTest extends WallabagCoreTestCase
483 484
484 $crawler = $client->followRedirect(); 485 $crawler = $client->followRedirect();
485 486
486 $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); 487 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
487 $this->assertContains('My updated title hehe :)', $alert[0]); 488 $this->assertContains('My updated title hehe :)', $title[0]);
489 $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']));
490 $this->assertContains('example.io', trim($stats[1]));
491 }
492
493 public function testEditRemoveOriginUrl()
494 {
495 $this->logInAs('admin');
496 $client = $this->getClient();
497
498 $entry = new Entry($this->getLoggedInUser());
499 $entry->setUrl($this->url);
500 $this->getEntityManager()->persist($entry);
501 $this->getEntityManager()->flush();
502
503 $crawler = $client->request('GET', '/edit/' . $entry->getId());
504
505 $this->assertSame(200, $client->getResponse()->getStatusCode());
506
507 $form = $crawler->filter('button[type=submit]')->form();
508
509 $data = [
510 'entry[title]' => 'My updated title hehe :)',
511 'entry[origin_url]' => '',
512 ];
513
514 $client->submit($form, $data);
515
516 $this->assertSame(302, $client->getResponse()->getStatusCode());
517
518 $crawler = $client->followRedirect();
519
520 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
521 $this->assertContains('My updated title hehe :)', $title[0]);
522 $this->assertSame(1, sizeof($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
523 $this->assertNotContains('example.io', trim($stats[0]));
488 } 524 }
489 525
490 public function testToggleArchive() 526 public function testToggleArchive()