]> git.immae.eu Git - github/wallabag/wallabag.git/blob - tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
Add a new endpoint to retrieve information from the wallabag instance
[github/wallabag/wallabag.git] / tests / Wallabag / ApiBundle / Controller / WallabagRestControllerTest.php
1 <?php
2
3 namespace Tests\Wallabag\ApiBundle\Controller;
4
5 use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
6
7 class WallabagRestControllerTest extends WallabagApiTestCase
8 {
9 public function testGetVersion()
10 {
11 // create a new client instead of using $this->client to be sure client isn't authenticated
12 $client = static::createClient();
13 $client->request('GET', '/api/version');
14
15 $this->assertSame(200, $client->getResponse()->getStatusCode());
16
17 $content = json_decode($client->getResponse()->getContent(), true);
18
19 $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content);
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 }
38 }