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.php46
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');