aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-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()