-
-
Notifications
You must be signed in to change notification settings - Fork 888
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix WriteListener trying to generate IRI for non-resource
- Loading branch information
1 parent
9ad81f8
commit 425d5d2
Showing
12 changed files
with
215 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Feature: JSON DTO input and output | ||
In order to use the API | ||
As a client software developer | ||
I need to be able to use DTOs on my resources as Input or Output objects. | ||
|
||
Background: | ||
Given I add "Accept" header equal to "application/json" | ||
And I add "Content-Type" header equal to "application/json" | ||
|
||
Scenario: Messenger handler returning output object | ||
And I send a "POST" request to "/users/password_reset_request" with body: | ||
""" | ||
{ | ||
"email": "user@example.com" | ||
} | ||
""" | ||
Then the response status code should be 201 | ||
And the response should be in JSON | ||
And the header "Content-Type" should be equal to "application/json; charset=utf-8" | ||
And the JSON should be equal to: | ||
""" | ||
{ | ||
"emailSentAt": "2019-07-05T15:44:00+00:00" | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Dto; | ||
|
||
use Symfony\Component\Serializer\Annotation\Groups; | ||
|
||
final class PasswordResetRequest | ||
{ | ||
/** | ||
* @Groups({"user_password_reset_request"}) | ||
*/ | ||
private $email; | ||
|
||
public function __construct(string $email = '') | ||
{ | ||
$this->email = $email; | ||
} | ||
|
||
public function getEmail(): string | ||
{ | ||
return $this->email; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/Fixtures/TestBundle/Dto/PasswordResetRequestResult.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Dto; | ||
|
||
use Symfony\Component\Serializer\Annotation\Groups; | ||
|
||
final class PasswordResetRequestResult | ||
{ | ||
/** | ||
* @Groups({"user_password_reset_request"}) | ||
*/ | ||
private $emailSentAt; | ||
|
||
public function __construct(\DateTimeInterface $emailSentAt) | ||
{ | ||
$this->emailSentAt = $emailSentAt; | ||
} | ||
|
||
public function getEmailSentAt(): \DateTimeInterface | ||
{ | ||
return $this->emailSentAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/Fixtures/TestBundle/MessageHandler/PasswordResetRequestHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\MessageHandler; | ||
|
||
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Dto\PasswordResetRequest; | ||
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Dto\PasswordResetRequestResult; | ||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface; | ||
|
||
class PasswordResetRequestHandler implements MessageHandlerInterface | ||
{ | ||
public function __invoke(PasswordResetRequest $passwordResetRequest): PasswordResetRequestResult | ||
{ | ||
return new PasswordResetRequestResult(new \DateTimeImmutable('2019-07-05T15:44:00Z')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters