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,30 @@
<?php
namespace App\Tests\Controller;
use App\Entity\User;
use App\Factory\UserFactory;
use App\Tests\AbstractTest;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;
final class MeControllerTest extends AbstractTest
{
use ResetDatabase;
use Factories;
/**
* @throws TransportExceptionInterface
*/
public function testGetMyProfile(): void
{
$testUser = UserFactory::createOne();
$client = MeControllerTest::createClientWithCredentials(MeControllerTest::getToken($testUser));
$client->request('GET', '/api/me');
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceItemJsonSchema(User::class);
}
}