diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2020-03-21 21:11:01 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2020-03-22 17:01:39 +0100 |
commit | 8ee7b1603d23297a6c183105f79b1290ce9828bf (patch) | |
tree | 15718b08724227f379a8af69c1a6a7ed8ab6c870 /tests | |
parent | ef81e3c89b00712476b0698e7c9057fc05a2e1c9 (diff) | |
download | wallabag-8ee7b1603d23297a6c183105f79b1290ce9828bf.tar.gz wallabag-8ee7b1603d23297a6c183105f79b1290ce9828bf.tar.zst wallabag-8ee7b1603d23297a6c183105f79b1290ce9828bf.zip |
Fix createdAt date range filter
- hiddenName has been disabled in order to fix the missing date range
values when using the material theme
- data format has been changed to 'Y-m-d' in order to comply with the
browser date input default format
- tests: date() and strtotime have been replaced with DateTime-related
objects
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 29d15eea..3dcc1cd0 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -822,13 +822,25 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
822 | $this->logInAs('admin'); | 822 | $this->logInAs('admin'); |
823 | $client = $this->getClient(); | 823 | $client = $this->getClient(); |
824 | 824 | ||
825 | $em = $this->getEntityManager(); | ||
826 | |||
827 | $today = new \DateTimeImmutable(); | ||
828 | $tomorrow = $today->add(new \DateInterval('P1D')); | ||
829 | $yesterday = $today->sub(new \DateInterval('P1D')); | ||
830 | |||
831 | $entry = new Entry($this->getLoggedInUser()); | ||
832 | $entry->setUrl('http://0.0.0.0/testFilterOnCreationDate'); | ||
833 | $entry->setCreatedAt($yesterday); | ||
834 | $em->persist($entry); | ||
835 | $em->flush(); | ||
836 | |||
825 | $crawler = $client->request('GET', '/unread/list'); | 837 | $crawler = $client->request('GET', '/unread/list'); |
826 | 838 | ||
827 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 839 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
828 | 840 | ||
829 | $data = [ | 841 | $data = [ |
830 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 842 | 'entry_filter[createdAt][left_date]' => $today->format('Y-m-d'), |
831 | 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), | 843 | 'entry_filter[createdAt][right_date]' => $tomorrow->format('Y-m-d'), |
832 | ]; | 844 | ]; |
833 | 845 | ||
834 | $crawler = $client->submit($form, $data); | 846 | $crawler = $client->submit($form, $data); |
@@ -836,8 +848,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
836 | $this->assertCount(5, $crawler->filter('li.entry')); | 848 | $this->assertCount(5, $crawler->filter('li.entry')); |
837 | 849 | ||
838 | $data = [ | 850 | $data = [ |
839 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 851 | 'entry_filter[createdAt][left_date]' => $today->format('Y-m-d'), |
840 | 'entry_filter[createdAt][right_date]' => date('d/m/Y'), | 852 | 'entry_filter[createdAt][right_date]' => $today->format('Y-m-d'), |
841 | ]; | 853 | ]; |
842 | 854 | ||
843 | $crawler = $client->submit($form, $data); | 855 | $crawler = $client->submit($form, $data); |
@@ -845,8 +857,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
845 | $this->assertCount(5, $crawler->filter('li.entry')); | 857 | $this->assertCount(5, $crawler->filter('li.entry')); |
846 | 858 | ||
847 | $data = [ | 859 | $data = [ |
848 | 'entry_filter[createdAt][left_date]' => '01/01/1970', | 860 | 'entry_filter[createdAt][left_date]' => '1970-01-01', |
849 | 'entry_filter[createdAt][right_date]' => '01/01/1970', | 861 | 'entry_filter[createdAt][right_date]' => '1970-01-01', |
850 | ]; | 862 | ]; |
851 | 863 | ||
852 | $crawler = $client->submit($form, $data); | 864 | $crawler = $client->submit($form, $data); |