mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-18 02:05:36 +00:00
31 lines
766 B
PHP
31 lines
766 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Tests;
|
||
|
|
|
||
|
|
use App\Entity\User;
|
||
|
|
use App\Factory\UserFactory;
|
||
|
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||
|
|
use Zenstruck\Foundry\Test\Factories;
|
||
|
|
use Zenstruck\Foundry\Test\ResetDatabase;
|
||
|
|
|
||
|
|
final class UserTest extends AbstractTest
|
||
|
|
{
|
||
|
|
use ResetDatabase;
|
||
|
|
use Factories;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @throws TransportExceptionInterface
|
||
|
|
*/
|
||
|
|
public function testGetMyProfile(): void
|
||
|
|
{
|
||
|
|
$testUser = UserFactory::createOne();
|
||
|
|
$client = UserTest::createClientWithCredentials(UserTest::getToken($testUser));
|
||
|
|
|
||
|
|
$client->loginUser($testUser);
|
||
|
|
$client->request('GET', '/api/me');
|
||
|
|
|
||
|
|
$this->assertResponseIsSuccessful();
|
||
|
|
$this->assertMatchesResourceItemJsonSchema(User::class);
|
||
|
|
}
|
||
|
|
}
|