aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
index c39cc357..528366af 100644
--- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
@@ -121,6 +121,73 @@ class WallabagRestControllerTest extends WallabagApiTestCase
121 ); 121 );
122 } 122 }
123 123
124 public function testGetTaggedEntries()
125 {
126 $this->client->request('GET', '/api/entries', ['tags' => 'foo,bar']);
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 testGetDatedEntries()
147 {
148 $this->client->request('GET', '/api/entries', ['since' => 1]);
149
150 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
151
152 $content = json_decode($this->client->getResponse()->getContent(), true);
153
154 $this->assertGreaterThanOrEqual(1, count($content));
155 $this->assertNotEmpty($content['_embedded']['items']);
156 $this->assertGreaterThanOrEqual(1, $content['total']);
157 $this->assertEquals(1, $content['page']);
158 $this->assertGreaterThanOrEqual(1, $content['pages']);
159
160 $this->assertTrue(
161 $this->client->getResponse()->headers->contains(
162 'Content-Type',
163 'application/json'
164 )
165 );
166 }
167
168 public function testGetDatedSupEntries()
169 {
170 $future = new \DateTime(date('Y-m-d H:i:s'));
171 $this->client->request('GET', '/api/entries', ['since' => $future->getTimestamp() + 1000]);
172
173 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
174
175 $content = json_decode($this->client->getResponse()->getContent(), true);
176
177 $this->assertGreaterThanOrEqual(1, count($content));
178 $this->assertEmpty($content['_embedded']['items']);
179 $this->assertEquals(0, $content['total']);
180 $this->assertEquals(1, $content['page']);
181 $this->assertEquals(1, $content['pages']);
182
183 $this->assertTrue(
184 $this->client->getResponse()->headers->contains(
185 'Content-Type',
186 'application/json'
187 )
188 );
189 }
190
124 public function testDeleteEntry() 191 public function testDeleteEntry()
125 { 192 {
126 $entry = $this->client->getContainer() 193 $entry = $this->client->getContainer()