mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
minor #15873 [API][Shop] Add missing contract test for getting only locales from current channel (GSadee)
This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.13| | Bug fix? | no | | New feature? | no | | BC breaks? | no | | Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | related to #15872 | | License | MIT | <!-- - Bug fixes must be submitted against the 1.12 branch - Features and deprecations must be submitted against the 1.13 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits ------- [API][Shop] Add missing contract test for getting only locales from current channel
This commit is contained in:
commit
eebc66bd46
4 changed files with 56 additions and 3 deletions
16
tests/Api/DataFixtures/ORM/channel_without_locales.yaml
Normal file
16
tests/Api/DataFixtures/ORM/channel_without_locales.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Sylius\Component\Core\Model\Channel:
|
||||
channel_web:
|
||||
code: 'WEB'
|
||||
name: 'Web Channel'
|
||||
hostname: 'localhost'
|
||||
contactEmail: 'web@sylius.com'
|
||||
description: 'Lorem ipsum'
|
||||
baseCurrency: '@currency_usd'
|
||||
defaultLocale: '@locale_en'
|
||||
color: 'black'
|
||||
enabled: true
|
||||
taxCalculationStrategy: 'order_items_based'
|
||||
|
||||
Sylius\Component\Currency\Model\Currency:
|
||||
currency_usd:
|
||||
code: 'USD'
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"@context": "\/api\/v2\/contexts\/Locale",
|
||||
"@id": "\/api\/v2\/shop\/locales",
|
||||
"@type": "hydra:Collection",
|
||||
"hydra:member": [
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/locales\/en_US",
|
||||
"@type": "Locale",
|
||||
"code": "en_US",
|
||||
"name": "English (United States)"
|
||||
},
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/locales\/pl_PL",
|
||||
"@type": "Locale",
|
||||
"code": "pl_PL",
|
||||
"name": "Polish (Poland)"
|
||||
}
|
||||
],
|
||||
"hydra:totalItems": 2
|
||||
}
|
||||
|
|
@ -14,7 +14,13 @@
|
|||
"@type": "Locale",
|
||||
"code": "pl_PL",
|
||||
"name": "Polish (Poland)"
|
||||
},
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/locales\/ga_IE",
|
||||
"@type": "Locale",
|
||||
"code": "ga_IE",
|
||||
"name": "Irish (Ireland)"
|
||||
}
|
||||
],
|
||||
"hydra:totalItems": 2
|
||||
"hydra:totalItems": 3
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ final class LocalesTest extends JsonApiTestCase
|
|||
/** @test */
|
||||
public function it_gets_locales(): void
|
||||
{
|
||||
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
|
||||
$this->loadFixturesFromFiles(['channel_without_locales.yaml', 'locale.yaml']);
|
||||
|
||||
$this->client->request(method: 'GET', uri: '/api/v2/shop/locales', server: self::CONTENT_TYPE_HEADER);
|
||||
$response = $this->client->getResponse();
|
||||
|
|
@ -29,10 +29,21 @@ final class LocalesTest extends JsonApiTestCase
|
|||
$this->assertResponse($response, 'shop/locale/get_locales_response', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_gets_only_locales_from_current_channel(): void
|
||||
{
|
||||
$this->loadFixturesFromFiles(['locale.yaml', 'channel.yaml']);
|
||||
|
||||
$this->client->request(method: 'GET', uri: '/api/v2/shop/locales', server: self::CONTENT_TYPE_HEADER);
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertResponse($response, 'shop/locale/get_locales_from_channel_response', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_gets_locale(): void
|
||||
{
|
||||
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
|
||||
$this->loadFixturesFromFiles(['channel.yaml']);
|
||||
|
||||
$this->client->request(method: 'GET', uri: '/api/v2/shop/locales/en_US', server: self::CONTENT_TYPE_HEADER);
|
||||
$response = $this->client->getResponse();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue