Drop SQLite support (#2405)
This commit is contained in:
@@ -9,24 +9,28 @@
|
||||
|
||||
namespace App\Tests\API;
|
||||
|
||||
use App\Entity\Tag;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TagFixtures;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
class TagControllerTest extends APIControllerBaseTest
|
||||
{
|
||||
protected function importTagFixtures(HttpKernelBrowser $client): void
|
||||
/**
|
||||
* @return Tag[]
|
||||
*/
|
||||
protected function importTagFixtures(): array
|
||||
{
|
||||
$tagList = ['Test', 'Administration', 'Support', '#2018-001', '#2018-002', '#2018-003', 'Development',
|
||||
'Marketing', 'First Level Support', 'Bug Fixing'];
|
||||
|
||||
$fixture = new TagFixtures();
|
||||
$fixture->setTagArray($tagList);
|
||||
$this->importFixture($fixture);
|
||||
|
||||
return $this->importFixture($fixture);
|
||||
}
|
||||
|
||||
public function testIsSecure()
|
||||
@@ -37,7 +41,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testGetCollection()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->importTagFixtures($client);
|
||||
$this->importTagFixtures();
|
||||
$this->assertAccessIsGranted($client, '/api/tags');
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
@@ -50,7 +54,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testEmptyCollection()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->importTagFixtures($client);
|
||||
$this->importTagFixtures();
|
||||
$query = ['name' => 'nothing'];
|
||||
$this->assertAccessIsGranted($client, '/api/tags', 'GET', $query);
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
@@ -63,7 +67,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testPostAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->importTagFixtures($client);
|
||||
$this->importTagFixtures();
|
||||
$data = [
|
||||
'name' => 'foo',
|
||||
'color' => '#000FFF'
|
||||
@@ -81,7 +85,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testPostActionWithValidationErrors()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->importTagFixtures($client);
|
||||
$this->importTagFixtures();
|
||||
$data = [
|
||||
'name' => '1',
|
||||
'color' => '11231231231',
|
||||
@@ -95,7 +99,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testPostActionWithInvalidUser()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->importTagFixtures($client);
|
||||
$this->importTagFixtures();
|
||||
$data = [
|
||||
'name' => 'foo',
|
||||
];
|
||||
@@ -110,7 +114,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testPartOfEntries()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->importTagFixtures($client);
|
||||
$this->importTagFixtures();
|
||||
$query = ['name' => 'in'];
|
||||
$this->assertAccessIsGranted($client, '/api/tags', 'GET', $query);
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
@@ -127,9 +131,10 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
public function testDeleteAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->importTagFixtures($client);
|
||||
$tags = $this->importTagFixtures();
|
||||
$id = $tags[0]->getId();
|
||||
|
||||
$this->request($client, '/api/tags/1', 'DELETE');
|
||||
$this->request($client, '/api/tags/' . $id, 'DELETE');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$this->assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode());
|
||||
$this->assertEmpty($client->getResponse()->getContent());
|
||||
@@ -142,6 +147,6 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
|
||||
public function testDeleteActionWithUnknownTimesheet()
|
||||
{
|
||||
$this->assertEntityNotFoundForDelete(User::ROLE_ADMIN, '/api/tags/255');
|
||||
$this->assertEntityNotFoundForDelete(User::ROLE_ADMIN, '/api/tags/' . PHP_INT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user