aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-06-25 21:05:50 +0200
committerThomas Citharel <tcit@tcit.fr>2016-06-25 21:05:50 +0200
commite5fb89e5d31c1c0645e8dd252bb4f970dc5f3226 (patch)
tree4eff25e51efe9eeaaa4535621f67d3de734830d4 /tests
parent33e2aec18b25d2c47774fede22ecd91e936b4400 (diff)
downloadwallabag-e5fb89e5d31c1c0645e8dd252bb4f970dc5f3226.tar.gz
wallabag-e5fb89e5d31c1c0645e8dd252bb4f970dc5f3226.tar.zst
wallabag-e5fb89e5d31c1c0645e8dd252bb4f970dc5f3226.zip
Add since parameter
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php45
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()