]>
Commit | Line | Data |
---|---|---|
769e19dc J |
1 | <?php |
2 | ||
23634d5d | 3 | namespace Tests\Wallabag\ApiBundle\Controller; |
769e19dc | 4 | |
23634d5d | 5 | use Tests\Wallabag\ApiBundle\WallabagApiTestCase; |
769e19dc | 6 | |
8a493541 | 7 | class WallabagRestControllerTest extends WallabagApiTestCase |
769e19dc | 8 | { |
6f8310b4 TC |
9 | public function testGetVersion() |
10 | { | |
426bb453 JB |
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'); | |
9761bfa1 | 14 | |
f808b016 | 15 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
9761bfa1 | 16 | |
426bb453 | 17 | $content = json_decode($client->getResponse()->getContent(), true); |
9761bfa1 | 18 | |
f808b016 | 19 | $this->assertSame($client->getContainer()->getParameter('wallabag_core.version'), $content); |
9761bfa1 | 20 | } |
3bd65991 JB |
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 | } | |
769e19dc | 38 | } |