Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from fractalzombie/feature/github-workflows-and…
…-update-dependecies [RequestMapper]: GitHub Workflows, Symfony 5.4|6.0, Refactoring
- Loading branch information
Showing
7 changed files
with
79 additions
and
12 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
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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace FRZB\Component\RequestMapper\Tests\Unit\Data; | ||
|
||
|
||
use FRZB\Component\RequestMapper\Attribute\ParamConverter; | ||
use FRZB\Component\RequestMapper\Data\ConverterData; | ||
use FRZB\Component\RequestMapper\Tests\Helper\RequestHelper; | ||
use FRZB\Component\RequestMapper\Tests\Helper\TestConstant; | ||
use FRZB\Component\RequestMapper\Tests\Stub\CreateUserRequest; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; | ||
|
||
/** | ||
* @group request-mapper | ||
* | ||
* @internal | ||
*/ | ||
class ConverterDataTest extends TestCase | ||
{ | ||
public function testConverterDataMethods(): void | ||
{ | ||
$params = ['name' => TestConstant::USER_NAME]; | ||
$request = RequestHelper::makeRequest(Request::METHOD_POST, $params); | ||
$attribute = new ParamConverter(CreateUserRequest::class, 'request'); | ||
$data = new ConverterData($request, $attribute); | ||
|
||
self::assertSame($request, $data->getRequest()); | ||
self::assertSame($params, $data->getRequestParameters()); | ||
self::assertSame(CreateUserRequest::class, $data->getParameterClass()); | ||
self::assertSame([AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENT => true], $data->getSerializerContext()); | ||
self::assertSame(['Default'], $data->getValidationGroups()); | ||
self::assertTrue($data->isValidationNeeded()); | ||
} | ||
} |