diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-06-29 09:34:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-29 09:34:39 +0200 |
commit | a314b920bf20feedbeee6ce0432be89901091481 (patch) | |
tree | 7780e54b4ffc809c5f9248e29edfe8084dacc9b0 /tests/Wallabag/ApiBundle | |
parent | 33e2aec18b25d2c47774fede22ecd91e936b4400 (diff) | |
parent | e43c78abd9193641d07ea27d0275fc19419b89ad (diff) | |
download | wallabag-a314b920bf20feedbeee6ce0432be89901091481.tar.gz wallabag-a314b920bf20feedbeee6ce0432be89901091481.tar.zst wallabag-a314b920bf20feedbeee6ce0432be89901091481.zip |
Merge pull request #2176 from wallabag/add-since-parameter
Add since parameter
Diffstat (limited to 'tests/Wallabag/ApiBundle')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | 45 |
1 files changed, 45 insertions, 0 deletions
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 | |||
121 | ); | 121 | ); |
122 | } | 122 | } |
123 | 123 | ||
124 | public function testGetDatedEntries() | ||
125 | { | ||
126 | $this->client->request('GET', '/api/entries', ['since' => 1]); | ||
127 | |||
128 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
129 | |||
130 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
131 | |||
132 | $this->assertGreaterThanOrEqual(1, count($content)); | ||
133 | $this->assertNotEmpty($content['_embedded']['items']); | ||
134 | $this->assertGreaterThanOrEqual(1, $content['total']); | ||
135 | $this->assertEquals(1, $content['page']); | ||
136 | $this->assertGreaterThanOrEqual(1, $content['pages']); | ||
137 | |||
138 | $this->assertTrue( | ||
139 | $this->client->getResponse()->headers->contains( | ||
140 | 'Content-Type', | ||
141 | 'application/json' | ||
142 | ) | ||
143 | ); | ||
144 | } | ||
145 | |||
146 | public function testGetDatedSupEntries() | ||
147 | { | ||
148 | $future = new \DateTime(date('Y-m-d H:i:s')); | ||
149 | $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]); | ||
150 | |||
151 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
152 | |||
153 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
154 | |||
155 | $this->assertGreaterThanOrEqual(1, count($content)); | ||
156 | $this->assertEmpty($content['_embedded']['items']); | ||
157 | $this->assertEquals(0, $content['total']); | ||
158 | $this->assertEquals(1, $content['page']); | ||
159 | $this->assertEquals(1, $content['pages']); | ||
160 | |||
161 | $this->assertTrue( | ||
162 | $this->client->getResponse()->headers->contains( | ||
163 | 'Content-Type', | ||
164 | 'application/json' | ||
165 | ) | ||
166 | ); | ||
167 | } | ||
168 | |||
124 | public function testDeleteEntry() | 169 | public function testDeleteEntry() |
125 | { | 170 | { |
126 | $entry = $this->client->getContainer() | 171 | $entry = $this->client->getContainer() |