mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-26 18:21:02 +00:00
Move test files directly under tests/ directory
This commit is contained in:
parent
a37b385c23
commit
24da70e338
117 changed files with 4 additions and 4 deletions
45
tests/Controller/Api/ConfigRestControllerTest.php
Normal file
45
tests/Controller/Api/ConfigRestControllerTest.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller\Api;
|
||||
|
||||
class ConfigRestControllerTest extends WallabagApiTestCase
|
||||
{
|
||||
public function testGetConfig()
|
||||
{
|
||||
$this->client->request('GET', '/api/config.json');
|
||||
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
|
||||
|
||||
$config = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertArrayHasKey('id', $config);
|
||||
$this->assertArrayHasKey('items_per_page', $config);
|
||||
$this->assertArrayHasKey('language', $config);
|
||||
$this->assertArrayHasKey('reading_speed', $config);
|
||||
$this->assertArrayHasKey('action_mark_as_read', $config);
|
||||
$this->assertArrayHasKey('list_mode', $config);
|
||||
$this->assertArrayHasKey('display_thumbnails', $config);
|
||||
|
||||
$this->assertSame(200.0, $config['reading_speed']);
|
||||
$this->assertSame('en', $config['language']);
|
||||
|
||||
$this->assertCount(7, $config);
|
||||
|
||||
$this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
|
||||
}
|
||||
|
||||
public function testGetConfigWithoutAuthentication()
|
||||
{
|
||||
$client = $this->createUnauthorizedClient();
|
||||
$client->request('GET', '/api/config.json');
|
||||
$this->assertSame(401, $client->getResponse()->getStatusCode());
|
||||
|
||||
$config = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertArrayHasKey('error', $config);
|
||||
$this->assertArrayHasKey('error_description', $config);
|
||||
|
||||
$this->assertSame('access_denied', $config['error']);
|
||||
|
||||
$this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue