mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Api][Zone] Minor improvements
This commit is contained in:
parent
28819a6c0a
commit
cef262a4b4
2 changed files with 13 additions and 3 deletions
|
|
@ -39,7 +39,6 @@ final class ZoneDenormalizerSpec extends ObjectBehavior
|
|||
ZoneInterface $zone
|
||||
): void {
|
||||
$sectionProvider->getSection()->willReturn(new AdminApiSection());
|
||||
|
||||
$this
|
||||
->supportsDenormalization([], ZoneInterface::class, null, [AbstractNormalizer::OBJECT_TO_POPULATE => $zone])
|
||||
->shouldReturn(true)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ final class ZonesTest extends JsonApiTestCase
|
|||
$this->client->request(
|
||||
method: 'POST',
|
||||
uri: '/api/v2/admin/zones',
|
||||
server: $this->headerBuilder()->withJsonLdContentType()->withJsonLdAccept()->withAdminUserAuthorization('api@example.com')->build(),
|
||||
server: $this->buildHeaders(),
|
||||
content: json_encode([
|
||||
'code' => 'US',
|
||||
'name' => 'UnitedStates',
|
||||
|
|
@ -101,7 +101,7 @@ final class ZonesTest extends JsonApiTestCase
|
|||
$this->client->request(
|
||||
method: 'PUT',
|
||||
uri: sprintf('/api/v2/admin/zones/%s', $zone->getCode()),
|
||||
server: $this->headerBuilder()->withJsonLdContentType()->withJsonLdAccept()->withAdminUserAuthorization('api@example.com')->build(),
|
||||
server: $this->buildHeaders(),
|
||||
content: json_encode([
|
||||
'name' => 'EuropeanUnion',
|
||||
'members' => [
|
||||
|
|
@ -134,4 +134,15 @@ final class ZonesTest extends JsonApiTestCase
|
|||
|
||||
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
/** @return array<string, string> */
|
||||
private function buildHeaders(): array
|
||||
{
|
||||
return $this
|
||||
->headerBuilder()
|
||||
->withJsonLdContentType()
|
||||
->withJsonLdAccept()
|
||||
->withAdminUserAuthorization('api@example.com')
|
||||
->build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue