test: add some KernelTestCase

This commit is contained in:
Maël Gangloff
2025-10-14 17:40:48 +02:00
parent 39262814ce
commit 97ea1ab33a
10 changed files with 255 additions and 10 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Tests\Controller;
use App\Entity\Connector;
use App\Factory\UserFactory;
use App\Tests\AbstractTest;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;
final class ConnectorControllerTest extends AbstractTest
{
use ResetDatabase;
use Factories;
public function testGetConnectorCollection(): void
{
$testUser = UserFactory::createOne();
$client = ConnectorControllerTest::createClientWithCredentials(ConnectorControllerTest::getToken($testUser));
$response = $client->request('GET', '/api/connectors');
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(Connector::class);
$this->assertCount(0, $response->toArray()['hydra:member']);
}
}