mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
test: move RegisterUserProcessorTest
This commit is contained in:
parent
767949aefa
commit
0de6c7a132
@ -36,7 +36,6 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
),
|
||||
new Post(
|
||||
uriTemplate: '/register',
|
||||
routeName: 'user_register',
|
||||
openapiContext: [
|
||||
'summary' => 'Register a new user',
|
||||
'description' => 'If the server configuration allows it, this endpoint enables the registration of a new user. Depending on the server configuration, a confirmation email may be sent to the provided email address so that the user can verify their email address.',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
namespace App\Tests\State;
|
||||
|
||||
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
|
||||
use App\Factory\UserFactory;
|
||||
@ -8,7 +8,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
final class RegistrationControllerTest extends ApiTestCase
|
||||
final class RegisterUserProcessorTest extends ApiTestCase
|
||||
{
|
||||
use Factories;
|
||||
|
||||
@ -17,15 +17,15 @@ final class RegistrationControllerTest extends ApiTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
RegistrationControllerTest::$container = RegistrationControllerTest::getContainer();
|
||||
RegistrationControllerTest::$entityManager = RegistrationControllerTest::$container->get(EntityManagerInterface::class);
|
||||
RegisterUserProcessorTest::$container = RegisterUserProcessorTest::getContainer();
|
||||
RegisterUserProcessorTest::$entityManager = RegisterUserProcessorTest::$container->get(EntityManagerInterface::class);
|
||||
}
|
||||
|
||||
public function testRegister(): void
|
||||
{
|
||||
$testUser = UserFactory::createOne();
|
||||
RegistrationControllerTest::$entityManager->remove($testUser);
|
||||
RegistrationControllerTest::$entityManager->flush();
|
||||
RegisterUserProcessorTest::$entityManager->remove($testUser);
|
||||
RegisterUserProcessorTest::$entityManager->flush();
|
||||
|
||||
$client = $this->createClient();
|
||||
$client->request('POST', '/api/register', [
|
||||
@ -47,7 +47,7 @@ final class RegistrationControllerTest extends ApiTestCase
|
||||
'password' => 'MySuperPassword123',
|
||||
],
|
||||
]);
|
||||
$this->assertResponseStatusCodeSame(400);
|
||||
$this->assertResponseStatusCodeSame(422);
|
||||
}
|
||||
|
||||
public function testRegisterEmptyPassword(): void
|
||||
@ -59,7 +59,7 @@ final class RegistrationControllerTest extends ApiTestCase
|
||||
'password' => '',
|
||||
],
|
||||
]);
|
||||
$this->assertResponseStatusCodeSame(400);
|
||||
$this->assertResponseStatusCodeSame(422);
|
||||
}
|
||||
|
||||
public function testRegisterWeakPassword(): void
|
||||
@ -71,6 +71,6 @@ final class RegistrationControllerTest extends ApiTestCase
|
||||
'password' => '123',
|
||||
],
|
||||
]);
|
||||
$this->assertResponseStatusCodeSame(400);
|
||||
$this->assertResponseStatusCodeSame(422);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user