aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2020-04-25 10:33:41 +0200
committerNicolas Lœuillet <nicolas@loeuillet.org>2020-04-28 10:14:46 +0200
commit76459e5694084f3eea6d30f438ffc95fb35cbe67 (patch)
tree61ac62a99b0cd3abd405589960fdd6a0707402c5
parent074110ca2dd3ba0d58f2fa93076933d06b46df77 (diff)
downloadwallabag-76459e5694084f3eea6d30f438ffc95fb35cbe67.tar.gz
wallabag-76459e5694084f3eea6d30f438ffc95fb35cbe67.tar.zst
wallabag-76459e5694084f3eea6d30f438ffc95fb35cbe67.zip
Added tests
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntrySortType.php2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ja.yml13
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml13
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.th.yml13
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.zh.yml13
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php197
18 files changed, 335 insertions, 42 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php b/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php
index ac251c5b..4ad54118 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php
@@ -36,8 +36,8 @@ class EntrySortType extends AbstractType
36 'entry.sort.by.creation_date' => 'createdAt', 36 'entry.sort.by.creation_date' => 'createdAt',
37 'entry.sort.by.starred_date' => 'starredAt', 37 'entry.sort.by.starred_date' => 'starredAt',
38 'entry.sort.by.archive_date' => 'archivedAt', 38 'entry.sort.by.archive_date' => 'archivedAt',
39 'entry.sort.by.title' => 'title',
40 'entry.sort.by.last_updated' => 'updatedAt', 39 'entry.sort.by.last_updated' => 'updatedAt',
40 'entry.sort.by.title' => 'title',
41 ], 41 ],
42 'label' => 'entry.sort.status_label', 42 'label' => 'entry.sort.status_label',
43 ]) 43 ])
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 0c35f2f9..20a3fa50 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 # back_to_top: 'Back to top' 275 # back_to_top: 'Back to top'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 73ecebb9..d998cfc8 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: 'Nach oben' 275 back_to_top: 'Nach oben'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index c7699ef0..635937a5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -263,6 +263,8 @@ entry:
263 order_label: 'Order' 263 order_label: 'Order'
264 by: 264 by:
265 creation_date: 'Creation date' 265 creation_date: 'Creation date'
266 starred_date: 'Starred date'
267 archive_date: 'Archived date'
266 title: 'Title' 268 title: 'Title'
267 last_updated: 'Last updated' 269 last_updated: 'Last updated'
268 ascending: 'Ascending' 270 ascending: 'Ascending'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 1d834290..9945e24b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: 'Regrese al principio' 275 back_to_top: 'Regrese al principio'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 46e96c04..6cb3be43 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: 'بازگشت به بالای صفحه' 275 back_to_top: 'بازگشت به بالای صفحه'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index dc75f5c1..75df9260 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 title: 'Options de tri' 261 title: 'Options de tri'
262 status_label: 'Trier par' 262 status_label: 'Trier par'
263 order_label: 'Ordre'
263 by: 264 by:
264 creation_date: 'Date de création' 265 creation_date: 'Date de création'
266 starred_date: 'Date de mise en favori date'
267 archive_date: "Date d'archivage"
265 title: 'Titre' 268 title: 'Titre'
266 last_updated: 'Dernière mise à jour' 269 last_updated: 'Dernière mise à jour'
267 ascending: 'Ascendant' 270 ascending: 'Ascendant'
268 descending: 'Descendant' 271 descending: 'Descendant'
272 sort: 'Trier'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: "Revenir en haut" 275 back_to_top: "Revenir en haut"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 804871b1..7e30fa8a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: "Torna all'inizio" 275 back_to_top: "Torna all'inizio"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ja.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ja.yml
index 9ae4d6bb..38e8e95c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ja.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ja.yml
@@ -236,6 +236,19 @@ entry:
236 action: 236 action:
237 clear: '解除' 237 clear: '解除'
238 filter: '検索' 238 filter: '検索'
239 sort:
240 # title: 'Sort options'
241 # status_label: 'Sort by'
242 # order_label: 'Order'
243 # by:
244 # creation_date: 'Creation date'
245 # starred_date: 'Starred date'
246 # archive_date: 'Archived date'
247 # title: 'Title'
248 # last_updated: 'Last updated'
249 # ascending: 'Ascending'
250 # descending: 'Descending'
251 # sort: 'Sort'
239 view: 252 view:
240 left_menu: 253 left_menu:
241 back_to_top: 'トップへ戻る' 254 back_to_top: 'トップへ戻る'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 93b844d8..7bda5880 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: 'Tornar en naut' 275 back_to_top: 'Tornar en naut'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 0f0d8378..77b93403 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: 'Wróć na górę' 275 back_to_top: 'Wróć na górę'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 5a403c23..dd34d579 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 back_to_top: 'Voltar ao topo' 275 back_to_top: 'Voltar ao topo'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 55fcead7..0991c373 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 # back_to_top: 'Back to top' 275 # back_to_top: 'Back to top'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
index f593a037..d151e351 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
@@ -256,6 +256,19 @@ entry:
256 action: 256 action:
257 clear: 'Очистить' 257 clear: 'Очистить'
258 filter: 'Выбрать' 258 filter: 'Выбрать'
259 sort:
260 # title: 'Sort options'
261 # status_label: 'Sort by'
262 # order_label: 'Order'
263 # by:
264 # creation_date: 'Creation date'
265 # starred_date: 'Starred date'
266 # archive_date: 'Archived date'
267 # title: 'Title'
268 # last_updated: 'Last updated'
269 # ascending: 'Ascending'
270 # descending: 'Descending'
271 # sort: 'Sort'
259 view: 272 view:
260 left_menu: 273 left_menu:
261 back_to_top: 'Наверх' 274 back_to_top: 'Наверх'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
index fa013e55..30364443 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
@@ -256,6 +256,19 @@ entry:
256 action: 256 action:
257 clear: 'ล้าง' 257 clear: 'ล้าง'
258 filter: 'ตัวกรอง' 258 filter: 'ตัวกรอง'
259 sort:
260 # title: 'Sort options'
261 # status_label: 'Sort by'
262 # order_label: 'Order'
263 # by:
264 # creation_date: 'Creation date'
265 # starred_date: 'Starred date'
266 # archive_date: 'Archived date'
267 # title: 'Title'
268 # last_updated: 'Last updated'
269 # ascending: 'Ascending'
270 # descending: 'Descending'
271 # sort: 'Sort'
259 view: 272 view:
260 left_menu: 273 left_menu:
261 back_to_top: 'กลับไปข้างบน' 274 back_to_top: 'กลับไปข้างบน'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 0f5655fa..84a48f5b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -260,12 +260,16 @@ entry:
260 sort: 260 sort:
261 # title: 'Sort options' 261 # title: 'Sort options'
262 # status_label: 'Sort by' 262 # status_label: 'Sort by'
263 # order_label: 'Order'
263 # by: 264 # by:
264 # creation_date: 'Creation date' 265 # creation_date: 'Creation date'
265 # title: 'Title' 266 # starred_date: 'Starred date'
266 # last_updated: 'Last updated' 267 # archive_date: 'Archived date'
267 #ascending: 'Asencending' 268 # title: 'Title'
269 # last_updated: 'Last updated'
270 # ascending: 'Ascending'
268 # descending: 'Descending' 271 # descending: 'Descending'
272 # sort: 'Sort'
269 view: 273 view:
270 left_menu: 274 left_menu:
271 # back_to_top: 'Back to top' 275 # back_to_top: 'Back to top'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.zh.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.zh.yml
index e68b91b7..dad26cba 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.zh.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.zh.yml
@@ -236,6 +236,19 @@ entry:
236 action: 236 action:
237 clear: '清除' 237 clear: '清除'
238 filter: '筛选' 238 filter: '筛选'
239 sort:
240 # title: 'Sort options'
241 # status_label: 'Sort by'
242 # order_label: 'Order'
243 # by:
244 # creation_date: 'Creation date'
245 # starred_date: 'Starred date'
246 # archive_date: 'Archived date'
247 # title: 'Title'
248 # last_updated: 'Last updated'
249 # ascending: 'Ascending'
250 # descending: 'Descending'
251 # sort: 'Sort'
239 view: 252 view:
240 left_menu: 253 left_menu:
241 back_to_top: '返回顶部' 254 back_to_top: '返回顶部'
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 15f05d48..765c108e 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -1041,7 +1041,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1041 $this->assertSame('test title entry' . $ids[$key], $result); 1041 $this->assertSame('test title entry' . $ids[$key], $result);
1042 } 1042 }
1043 1043
1044 rsort($ids); 1044 $ids = array_reverse($ids);
1045 1045
1046 $crawler = $client->request('GET', '/unread/list'); 1046 $crawler = $client->request('GET', '/unread/list');
1047 $form = $crawler->filter('button[id=submit-sort]')->form(); 1047 $form = $crawler->filter('button[id=submit-sort]')->form();
@@ -1061,6 +1061,201 @@ class EntryControllerTest extends WallabagCoreTestCase
1061 } 1061 }
1062 } 1062 }
1063 1063
1064 public function testSortOnCreationDate()
1065 {
1066 $this->logInAs('admin');
1067 $client = $this->getClient();
1068
1069 $entry1 = new Entry($this->getLoggedInUser());
1070 $entry1->setTitle('test title entry7');
1071 $entry1->setCreatedAt(new \DateTime('2013-04-03T13:37:00'));
1072 $this->getEntityManager()->persist($entry1);
1073
1074 $entry2 = new Entry($this->getLoggedInUser());
1075 $entry2->setTitle('test title entry8');
1076 $entry2->setCreatedAt(new \DateTime('2012-04-03T13:37:00'));
1077 $this->getEntityManager()->persist($entry2);
1078
1079 $entry3 = new Entry($this->getLoggedInUser());
1080 $entry3->setTitle('test title entry9');
1081 $entry3->setCreatedAt(new \DateTime('2014-04-03T13:37:00'));
1082 $this->getEntityManager()->persist($entry3);
1083
1084 $this->getEntityManager()->flush();
1085
1086 $crawler = $client->request('GET', '/unread/list');
1087 $form = $crawler->filter('button[id=submit-sort]')->form();
1088 $data = [
1089 'entry_sort[sortType]' => 'createdAt',
1090 'entry_sort[sortOrder]' => 'asc',
1091 ];
1092 $crawler = $client->submit($form, $data);
1093
1094 $this->assertCount(7, $crawler->filter('li.entry'));
1095
1096 $matches = [];
1097 preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
1098
1099 $results = array_values(array_unique($matches[0]));
1100
1101 $ids = [8, 7, 9, 1, 2, 4, 5];
1102
1103 foreach ($results as $key => $result) {
1104 $this->assertSame('test title entry' . $ids[$key], $result);
1105 }
1106
1107 $ids = array_reverse($ids);
1108
1109 $crawler = $client->request('GET', '/unread/list');
1110 $form = $crawler->filter('button[id=submit-sort]')->form();
1111 $data = [
1112 'entry_sort[sortType]' => 'createdAt',
1113 'entry_sort[sortOrder]' => 'desc',
1114 ];
1115 $crawler = $client->submit($form, $data);
1116
1117 $matches = [];
1118 preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
1119
1120 $results = array_values(array_unique($matches[0]));
1121
1122 foreach ($results as $key => $result) {
1123 $this->assertSame('test title entry' . $ids[$key], $result);
1124 }
1125 }
1126
1127 public function testSortOnStarredDate()
1128 {
1129 $this->logInAs('admin');
1130 $client = $this->getClient();
1131
1132 $entry1 = new Entry($this->getLoggedInUser());
1133 $entry1->setTitle('test title entry7');
1134 $entry1->setStarred(true);
1135 $entry1->setStarredAt(new \DateTime('2013-04-03T13:37:00'));
1136 $this->getEntityManager()->persist($entry1);
1137
1138 $entry2 = new Entry($this->getLoggedInUser());
1139 $entry2->setTitle('test title entry8');
1140 $entry2->setStarred(true);
1141 $entry2->setStarredAt(new \DateTime('2012-04-03T13:37:00'));
1142 $this->getEntityManager()->persist($entry2);
1143
1144 $entry3 = new Entry($this->getLoggedInUser());
1145 $entry3->setTitle('test title entry9');
1146 $entry3->setStarred(true);
1147 $entry3->setStarredAt(new \DateTime('2014-04-03T13:37:00'));
1148 $this->getEntityManager()->persist($entry3);
1149
1150 $this->getEntityManager()->flush();
1151
1152 $crawler = $client->request('GET', '/starred/list');
1153 $form = $crawler->filter('button[id=submit-sort]')->form();
1154 $data = [
1155 'entry_sort[sortType]' => 'starredAt',
1156 'entry_sort[sortOrder]' => 'asc',
1157 ];
1158 $crawler = $client->submit($form, $data);
1159
1160 $this->assertCount(4, $crawler->filter('li.entry'));
1161
1162 $matches = [];
1163 preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
1164
1165 $results = array_values(array_unique($matches[0]));
1166
1167 $ids = [5, 8, 7, 9];
1168
1169 foreach ($results as $key => $result) {
1170 $this->assertSame('test title entry' . $ids[$key], $result);
1171 }
1172
1173 $ids = array_reverse($ids);
1174
1175 $crawler = $client->request('GET', '/starred/list');
1176 $form = $crawler->filter('button[id=submit-sort]')->form();
1177 $data = [
1178 'entry_sort[sortType]' => 'starredAt',
1179 'entry_sort[sortOrder]' => 'desc',
1180 ];
1181 $crawler = $client->submit($form, $data);
1182
1183 $matches = [];
1184 preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
1185
1186 $results = array_values(array_unique($matches[0]));
1187
1188 foreach ($results as $key => $result) {
1189 $this->assertSame('test title entry' . $ids[$key], $result);
1190 }
1191 }
1192
1193 public function testSortOnArchivedDate()
1194 {
1195 $this->logInAs('admin');
1196 $client = $this->getClient();
1197
1198 $entry1 = new Entry($this->getLoggedInUser());
1199 $entry1->setTitle('test title entry7');
1200 $entry1->setArchived(true);
1201 $entry1->setArchivedAt(new \DateTime('2010-04-03T13:37:00'));
1202 $this->getEntityManager()->persist($entry1);
1203
1204 $entry2 = new Entry($this->getLoggedInUser());
1205 $entry2->setTitle('test title entry8');
1206 $entry2->setArchived(true);
1207 $entry2->setArchivedAt(new \DateTime('2000-04-03T13:37:00'));
1208 $this->getEntityManager()->persist($entry2);
1209
1210 $entry3 = new Entry($this->getLoggedInUser());
1211 $entry3->setTitle('test title entry9');
1212 $entry3->setArchived(true);
1213 $entry3->setArchivedAt(new \DateTime('2020-04-03T13:37:00'));
1214 $this->getEntityManager()->persist($entry3);
1215
1216 $this->getEntityManager()->flush();
1217
1218 $crawler = $client->request('GET', '/archive/list');
1219 $form = $crawler->filter('button[id=submit-sort]')->form();
1220 $data = [
1221 'entry_sort[sortType]' => 'archivedAt',
1222 'entry_sort[sortOrder]' => 'asc',
1223 ];
1224 $crawler = $client->submit($form, $data);
1225
1226 $this->assertCount(4, $crawler->filter('li.entry'));
1227
1228 $matches = [];
1229 preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
1230
1231 $results = array_values(array_unique($matches[0]));
1232
1233 $ids = [6, 8, 7, 9];
1234
1235 foreach ($results as $key => $result) {
1236 $this->assertSame('test title entry' . $ids[$key], $result);
1237 }
1238
1239 $ids = array_reverse($ids);
1240
1241 $crawler = $client->request('GET', '/archive/list');
1242 $form = $crawler->filter('button[id=submit-sort]')->form();
1243 $data = [
1244 'entry_sort[sortType]' => 'archivedAt',
1245 'entry_sort[sortOrder]' => 'desc',
1246 ];
1247 $crawler = $client->submit($form, $data);
1248
1249 $matches = [];
1250 preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
1251
1252 $results = array_values(array_unique($matches[0]));
1253
1254 foreach ($results as $key => $result) {
1255 $this->assertSame('test title entry' . $ids[$key], $result);
1256 }
1257 }
1258
1064 public function testShareEntryPublicly() 1259 public function testShareEntryPublicly()
1065 { 1260 {
1066 $this->logInAs('admin'); 1261 $this->logInAs('admin');