X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FApiBundle%2FController%2FWallabagRestControllerTest.php;h=f256a7f9fb37f290c1c0d01478a7bb40aec15cda;hb=e5fb89e5d31c1c0645e8dd252bb4f970dc5f3226;hp=c39cc357763e706a3da6364c53aecfd2421c5c53;hpb=33e2aec18b25d2c47774fede22ecd91e936b4400;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index c39cc357..f256a7f9 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -121,6 +121,51 @@ class WallabagRestControllerTest extends WallabagApiTestCase ); } + public function testGetDatedEntries() + { + $this->client->request('GET', '/api/entries', ['since' => 1]); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertGreaterThanOrEqual(1, count($content)); + $this->assertNotEmpty($content['_embedded']['items']); + $this->assertGreaterThanOrEqual(1, $content['total']); + $this->assertEquals(1, $content['page']); + $this->assertGreaterThanOrEqual(1, $content['pages']); + + $this->assertTrue( + $this->client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + } + + public function testGetDatedSupEntries() + { + $future = new \DateTime(date('Y-m-d H:i:s')); + $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertGreaterThanOrEqual(1, count($content)); + $this->assertEmpty($content['_embedded']['items']); + $this->assertEquals(0, $content['total']); + $this->assertEquals(1, $content['page']); + $this->assertEquals(1, $content['pages']); + + $this->assertTrue( + $this->client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + } + public function testDeleteEntry() { $entry = $this->client->getContainer()