mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Fix TranslatableDenormalizer for IRI strings and shop customer 404 for guests
This commit is contained in:
parent
a18b3e4517
commit
0bb7199014
3 changed files with 13 additions and 1 deletions
|
|
@ -50,6 +50,7 @@ final class TranslatableDenormalizer implements DenormalizerInterface, Denormali
|
|||
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
return
|
||||
is_array($data) &&
|
||||
Request::METHOD_POST === ($context[ContextKeys::HTTP_REQUEST_METHOD_TYPE] ?? null) &&
|
||||
!isset($context[self::getAlreadyCalledKey($type)]) &&
|
||||
is_a($type, TranslatableInterface::class, true)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,17 @@ final class TranslatableDenormalizerTest extends TestCase
|
|||
|
||||
public function testOnlySupportsTranslatableResource(): void
|
||||
{
|
||||
self::assertFalse(
|
||||
$this->translatableDenormalizer->supportsDenormalization(
|
||||
'iri-string',
|
||||
TranslatableInterface::class,
|
||||
null,
|
||||
[
|
||||
ContextKeys::HTTP_REQUEST_METHOD_TYPE => 'POST',
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
self::assertFalse(
|
||||
$this->translatableDenormalizer->supportsDenormalization(
|
||||
[],
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ final class CustomersTest extends JsonApiTestCase
|
|||
|
||||
$this->requestGet('/api/v2/shop/customers/' . $customer->getId());
|
||||
|
||||
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_NOT_FOUND);
|
||||
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue