diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-15 10:17:11 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-15 10:17:11 +0100 |
commit | 3bd65991adc253715c6b74ab0ee19ff2cf3e6c69 (patch) | |
tree | faf1b79e727db5a8fe1b092c75e0d8f2e67e3408 /tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | |
parent | 3afc87426dade0eaeccf69d144a119c6f0c4534f (diff) | |
download | wallabag-3bd65991adc253715c6b74ab0ee19ff2cf3e6c69.tar.gz wallabag-3bd65991adc253715c6b74ab0ee19ff2cf3e6c69.tar.zst wallabag-3bd65991adc253715c6b74ab0ee19ff2cf3e6c69.zip |
Add a new endpoint to retrieve information from the wallabag instance
Useful for api client which required some information.
We might add more inside them in the future.
The endpoint /api/version should be avoided now as it contains not so much information rather the version.
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index ac4d6cdc..8b49c0ae 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | |||
@@ -18,4 +18,21 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
18 | 18 | ||
19 | $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content); | 19 | $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content); |
20 | } | 20 | } |
21 | |||
22 | public function testGetInfo() | ||
23 | { | ||
24 | // create a new client instead of using $this->client to be sure client isn't authenticated | ||
25 | $client = static::createClient(); | ||
26 | $client->request('GET', '/api/info'); | ||
27 | |||
28 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
29 | |||
30 | $content = json_decode($client->getResponse()->getContent(), true); | ||
31 | |||
32 | $this->assertArrayHasKey('appname', $content); | ||
33 | $this->assertArrayHasKey('version', $content); | ||
34 | $this->assertArrayHasKey('allowed_registration', $content); | ||
35 | |||
36 | $this->assertSame('wallabag', $content['appname']); | ||
37 | } | ||
21 | } | 38 | } |