diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 2a2fd1a4..4ac4548b 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -478,6 +478,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
478 | 478 | ||
479 | $data = [ | 479 | $data = [ |
480 | 'entry[title]' => 'My updated title hehe :)', | 480 | 'entry[title]' => 'My updated title hehe :)', |
481 | 'entry[origin_url]' => 'https://example.io', | ||
481 | ]; | 482 | ]; |
482 | 483 | ||
483 | $client->submit($form, $data); | 484 | $client->submit($form, $data); |
@@ -486,8 +487,43 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
486 | 487 | ||
487 | $crawler = $client->followRedirect(); | 488 | $crawler = $client->followRedirect(); |
488 | 489 | ||
489 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); | 490 | $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); |
490 | $this->assertContains('My updated title hehe :)', $alert[0]); | 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]' => '', | ||
515 | ]; | ||
516 | |||
517 | $client->submit($form, $data); | ||
518 | |||
519 | $this->assertSame(302, $client->getResponse()->getStatusCode()); | ||
520 | |||
521 | $crawler = $client->followRedirect(); | ||
522 | |||
523 | $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); | ||
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])); | ||
491 | } | 527 | } |
492 | 528 | ||
493 | public function testToggleArchive() | 529 | public function testToggleArchive() |