diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-24 16:06:06 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-28 10:14:46 +0200 |
commit | 074110ca2dd3ba0d58f2fa93076933d06b46df77 (patch) | |
tree | 42b46f8058f78def2dff488725c9c1c3bed0d63f /tests/Wallabag | |
parent | 9b5552290445b404e6de0595d7d27a2de824230a (diff) | |
download | wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.tar.gz wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.tar.zst wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.zip |
First draft for tests
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 0aa562d8..15f05d48 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -1015,6 +1015,52 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1015 | $this->assertCount(2, $crawler->filter('li.entry')); | 1015 | $this->assertCount(2, $crawler->filter('li.entry')); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | public function testSortOnTitle() | ||
1019 | { | ||
1020 | $this->logInAs('admin'); | ||
1021 | $client = $this->getClient(); | ||
1022 | |||
1023 | $crawler = $client->request('GET', '/unread/list'); | ||
1024 | $form = $crawler->filter('button[id=submit-sort]')->form(); | ||
1025 | $data = [ | ||
1026 | 'entry_sort[sortType]' => 'title', | ||
1027 | 'entry_sort[sortOrder]' => 'asc', | ||
1028 | ]; | ||
1029 | $crawler = $client->submit($form, $data); | ||
1030 | |||
1031 | $this->assertCount(4, $crawler->filter('li.entry')); | ||
1032 | |||
1033 | $matches = []; | ||
1034 | preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches); | ||
1035 | |||
1036 | $results = array_values(array_unique($matches[0])); | ||
1037 | |||
1038 | $ids = [1, 2, 4, 5]; | ||
1039 | |||
1040 | foreach ($results as $key => $result) { | ||
1041 | $this->assertSame('test title entry' . $ids[$key], $result); | ||
1042 | } | ||
1043 | |||
1044 | rsort($ids); | ||
1045 | |||
1046 | $crawler = $client->request('GET', '/unread/list'); | ||
1047 | $form = $crawler->filter('button[id=submit-sort]')->form(); | ||
1048 | $data = [ | ||
1049 | 'entry_sort[sortType]' => 'title', | ||
1050 | 'entry_sort[sortOrder]' => 'desc', | ||
1051 | ]; | ||
1052 | $crawler = $client->submit($form, $data); | ||
1053 | |||
1054 | $matches = []; | ||
1055 | preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches); | ||
1056 | |||
1057 | $results = array_values(array_unique($matches[0])); | ||
1058 | |||
1059 | foreach ($results as $key => $result) { | ||
1060 | $this->assertSame('test title entry' . $ids[$key], $result); | ||
1061 | } | ||
1062 | } | ||
1063 | |||
1018 | public function testShareEntryPublicly() | 1064 | public function testShareEntryPublicly() |
1019 | { | 1065 | { |
1020 | $this->logInAs('admin'); | 1066 | $this->logInAs('admin'); |