aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2016-11-18 17:36:19 +0100
committerNicolas Lœuillet <nicolas@loeuillet.org>2016-11-19 20:05:16 +0100
commit32f455c1317bf536aea63147d2c5074ae7425d42 (patch)
tree5088c6a25dd29915f3c7de1411b86b9633166a72 /tests/Wallabag/CoreBundle
parent49b042dfdf33a0efd3c838e1476754e6019730d2 (diff)
downloadwallabag-32f455c1317bf536aea63147d2c5074ae7425d42.tar.gz
wallabag-32f455c1317bf536aea63147d2c5074ae7425d42.tar.zst
wallabag-32f455c1317bf536aea63147d2c5074ae7425d42.zip
Added tests
Diffstat (limited to 'tests/Wallabag/CoreBundle')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 09cf01b8..b248b178 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -1018,4 +1018,71 @@ class EntryControllerTest extends WallabagCoreTestCase
1018 1018
1019 $this->assertCount(7, $crawler->filter('div[class=entry]')); 1019 $this->assertCount(7, $crawler->filter('div[class=entry]'));
1020 } 1020 }
1021
1022 public function testSearch()
1023 {
1024 $this->logInAs('admin');
1025 $client = $this->getClient();
1026
1027 // Search on unread list
1028 $crawler = $client->request('GET', '/unread/list');
1029
1030 $form = $crawler->filter('form[name=search]')->form();
1031 $data = [
1032 'search_entry[term]' => 'title',
1033 ];
1034
1035 $crawler = $client->submit($form, $data);
1036
1037 $this->assertCount(4, $crawler->filter('div[class=entry]'));
1038
1039 // Search on starred list
1040 $crawler = $client->request('GET', '/starred/list');
1041
1042 $form = $crawler->filter('form[name=search]')->form();
1043 $data = [
1044 'search_entry[term]' => 'title',
1045 ];
1046
1047 $crawler = $client->submit($form, $data);
1048
1049 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1050
1051 // Added new article to test on archive list
1052 $crawler = $client->request('GET', '/new');
1053 $form = $crawler->filter('form[name=entry]')->form();
1054 $data = [
1055 'entry[url]' => $this->url,
1056 ];
1057 $client->submit($form, $data);
1058 $content = $client->getContainer()
1059 ->get('doctrine.orm.entity_manager')
1060 ->getRepository('WallabagCoreBundle:Entry')
1061 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
1062 $client->request('GET', '/archive/'.$content->getId());
1063
1064 $crawler = $client->request('GET', '/archive/list');
1065
1066 $form = $crawler->filter('form[name=search]')->form();
1067 $data = [
1068 'search_entry[term]' => 'manège',
1069 ];
1070
1071 $crawler = $client->submit($form, $data);
1072
1073 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1074 $client->request('GET', '/delete/'.$content->getId());
1075
1076 // test on list of all articles
1077 $crawler = $client->request('GET', '/all/list');
1078
1079 $form = $crawler->filter('form[name=search]')->form();
1080 $data = [
1081 'search_entry[term]' => 'pocket',
1082 ];
1083
1084 $crawler = $client->submit($form, $data);
1085
1086 $this->assertCount(0, $crawler->filter('div[class=entry]'));
1087 }
1021} 1088}