diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | 67 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | 6 |
2 files changed, 67 insertions, 6 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() |
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 6c6ce087..2413d735 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | |||
@@ -71,7 +71,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
71 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 71 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
72 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 72 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
73 | $this->assertContains('Config setup.', $tester->getDisplay()); | 73 | $this->assertContains('Config setup.', $tester->getDisplay()); |
74 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
75 | } | 74 | } |
76 | 75 | ||
77 | public function testRunInstallCommandWithReset() | 76 | public function testRunInstallCommandWithReset() |
@@ -103,7 +102,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
103 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); | 102 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); |
104 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 103 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
105 | $this->assertContains('Config setup.', $tester->getDisplay()); | 104 | $this->assertContains('Config setup.', $tester->getDisplay()); |
106 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
107 | 105 | ||
108 | // we force to reset everything | 106 | // we force to reset everything |
109 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); | 107 | $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); |
@@ -148,7 +146,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
148 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 146 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
149 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 147 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
150 | $this->assertContains('Config setup.', $tester->getDisplay()); | 148 | $this->assertContains('Config setup.', $tester->getDisplay()); |
151 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
152 | 149 | ||
153 | // the current database doesn't already exist | 150 | // the current database doesn't already exist |
154 | $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); | 151 | $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); |
@@ -186,7 +183,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
186 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 183 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
187 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 184 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
188 | $this->assertContains('Config setup.', $tester->getDisplay()); | 185 | $this->assertContains('Config setup.', $tester->getDisplay()); |
189 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
190 | 186 | ||
191 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); | 187 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); |
192 | } | 188 | } |
@@ -241,7 +237,6 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
241 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 237 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
242 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 238 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
243 | $this->assertContains('Config setup.', $tester->getDisplay()); | 239 | $this->assertContains('Config setup.', $tester->getDisplay()); |
244 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
245 | 240 | ||
246 | $this->assertContains('Creating schema', $tester->getDisplay()); | 241 | $this->assertContains('Creating schema', $tester->getDisplay()); |
247 | } | 242 | } |
@@ -274,6 +269,5 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
274 | $this->assertContains('Setting up database.', $tester->getDisplay()); | 269 | $this->assertContains('Setting up database.', $tester->getDisplay()); |
275 | $this->assertContains('Administration setup.', $tester->getDisplay()); | 270 | $this->assertContains('Administration setup.', $tester->getDisplay()); |
276 | $this->assertContains('Config setup.', $tester->getDisplay()); | 271 | $this->assertContains('Config setup.', $tester->getDisplay()); |
277 | $this->assertContains('Installing assets.', $tester->getDisplay()); | ||
278 | } | 272 | } |
279 | } | 273 | } |