Move to Symfony Flex

The structure changed completely.
Bundles are gone. Everything is flatten in the folder `src`.
I separated import & api controllers to avoid _pollution_ in the main controller folder.
This commit is contained in:
Jeremy Benoist
2022-12-20 22:36:02 +01:00
parent 911e0238b7
commit 6b5a518ce2
629 changed files with 7238 additions and 2194 deletions

View File

@ -0,0 +1,47 @@
<?php
namespace App\Tests\Controller\Api;
use App\Tests\WallabagApiTestCase;
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 = static::createClient();
$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'));
}
}