diff --git a/composer.json b/composer.json
index 2a878d1..331c650 100644
--- a/composer.json
+++ b/composer.json
@@ -51,7 +51,7 @@
"suggest": {
"doctrine/doctrine-bundle": "To connect with Doctrine in Symfony project",
"doctrine/orm": "To connect with Doctrine",
- "api-platform/core": "To connect with API Platform"
+ "api-platform/openapi": "To connect with API Platform"
},
"autoload": {
"psr-4": {
diff --git a/config/services.xml b/config/services.xml
index e6f23dd..b00f9e8 100644
--- a/config/services.xml
+++ b/config/services.xml
@@ -25,11 +25,9 @@
-
-
diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php
index 4ec39b6..6457d2e 100644
--- a/features/app/AppKernel.php
+++ b/features/app/AppKernel.php
@@ -61,16 +61,11 @@ public function registerBundles(): array
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle(),
new CoopTilleuls\ForgotPasswordBundle\CoopTilleulsForgotPasswordBundle(),
+ new ApiPlatform\Symfony\Bundle\ApiPlatformBundle(),
];
if ('jmsserializer' === $this->getEnvironment()) {
$bundles[] = new JMS\SerializerBundle\JMSSerializerBundle();
}
- if (class_exists(ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class)) {
- $bundles[] = new ApiPlatform\Symfony\Bundle\ApiPlatformBundle();
- } else {
- // BC api-platform/core:^2.7
- $bundles[] = new ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle();
- }
return $bundles;
}
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 6348eb6..ca8b4ed 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -71,7 +71,7 @@ public function resetDatabase(): void
*/
public function iHaveAValidToken(): void
{
- $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('+1 day'));
+ $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('+1 day'));
}
/**
@@ -79,7 +79,7 @@ public function iHaveAValidToken(): void
*/
public function iHaveAnExpiredToken(): void
{
- $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('-1 minute'));
+ $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('-1 minute'));
}
/**
@@ -166,7 +166,7 @@ public function theResponseShouldBeEmpty(): void
public function theRequestShouldBeInvalidWithMessage($message): void
{
Assert::assertEquals(
- 400,
+ 422,
$this->client->getResponse()->getStatusCode(),
sprintf('Response is not valid: got %d', $this->client->getResponse()->getStatusCode())
);
@@ -213,7 +213,7 @@ public function iResetMyPasswordUsingNoParameter(): void
*/
public function iUpdateMyPassword(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('+1 day'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('+1 day'));
$this->client->request(
'POST',
@@ -246,7 +246,7 @@ public function thePasswordShouldHaveBeenUpdated(): void
*/
public function iUpdateMyPasswordUsingNoPassword(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('+1 day'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('+1 day'));
$this->client->request('POST', sprintf('/api/forgot-password/%s', $token->getToken()));
}
@@ -275,7 +275,7 @@ public function iUpdateMyPasswordUsingAnInvalidToken(): void
*/
public function iUpdateMyPasswordUsingWrongProvider(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createAdmin(), new DateTime('+1 day'), $this->providerChain->get('admin'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createAdmin(), $this->providerChain->get('admin'), new DateTime('+1 day'));
$this->client->request(
'POST',
@@ -296,7 +296,7 @@ public function iUpdateMyPasswordUsingWrongProvider(): void
*/
public function iUpdateMyPasswordUsingAValidProviderButAnInvalidPasswordField(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createAdmin(), new DateTime('+1 day'), $this->providerChain->get('admin'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createAdmin(), $this->providerChain->get('admin'), new DateTime('+1 day'));
$this->client->request(
'POST',
@@ -317,7 +317,7 @@ public function iUpdateMyPasswordUsingAValidProviderButAnInvalidPasswordField():
*/
public function iUpdateMyPasswordUsingAnExpiredToken(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('-1 minute'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('-1 minute'));
$this->client->request(
'POST',
@@ -338,7 +338,7 @@ public function iUpdateMyPasswordUsingAnExpiredToken(): void
*/
public function iGetAPasswordToken(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('+1 day'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('+1 day'));
$token->setToken('d7xtQlJVyN61TzWtrY6xy37zOxB66BqMSDXEbXBbo2Mw4Jjt9C');
$this->doctrine->getManager()->persist($token);
$this->doctrine->getManager()->flush();
@@ -363,7 +363,7 @@ public function iShouldGetAPasswordToken(): void
*/
public function iGetAPasswordTokenUsingAnExpiredToken(): void
{
- $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), new DateTime('-1 minute'));
+ $token = $this->passwordTokenManager->createPasswordToken($this->createUser(), $this->providerChain->get('user'), new DateTime('-1 minute'));
$this->client->request('GET', sprintf('/api/forgot-password/%s', $token->getToken()));
}
@@ -472,7 +472,7 @@ private function getOpenApiPaths(): array
204 => [
'description' => 'Valid email address, no matter if user exists or not',
],
- 400 => [
+ 422 => [
'description' => 'Missing email parameter or invalid format',
],
],
@@ -547,7 +547,7 @@ private function getOpenApiPaths(): array
204 => [
'description' => 'Email address format valid, no matter if user exists or not',
],
- 400 => [
+ 422 => [
'description' => 'Missing password parameter',
],
404 => [
diff --git a/phpunit-legacy.xml.dist b/phpunit-legacy.xml.dist
index f0bdeab..bb0963f 100644
--- a/phpunit-legacy.xml.dist
+++ b/phpunit-legacy.xml.dist
@@ -23,7 +23,7 @@
-