3 namespace Tests\Wallabag\ApiBundle\Controller
;
5 use Tests\Wallabag\ApiBundle\WallabagApiTestCase
;
7 class WallabagRestControllerTest
extends WallabagApiTestCase
9 public function testGetVersion()
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');
15 $this->assertSame(200, $client->getResponse()->getStatusCode());
17 $content = json_decode($client->getResponse()->getContent(), true);
19 $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content);
22 public function testGetInfo()
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');
28 $this->assertSame(200, $client->getResponse()->getStatusCode());
30 $content = json_decode($client->getResponse()->getContent(), true);
32 $this->assertArrayHasKey('appname', $content);
33 $this->assertArrayHasKey('version', $content);
34 $this->assertArrayHasKey('allowed_registration', $content);
36 $this->assertSame('wallabag', $content['appname']);