mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
minor #15872 [API][Shop] Add missing contract test for getting only countries from current channel (GSadee)
This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.13 <!-- see the comment below --> | | Bug fix? | no | | New feature? | no | | BC breaks? | no | | Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | Based on https://github.com/Sylius/Sylius/pull/15871 | | 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 countries from current channel
This commit is contained in:
commit
5d825a965c
3 changed files with 72 additions and 0 deletions
26
tests/Api/DataFixtures/ORM/channel_with_countries.yaml
Normal file
26
tests/Api/DataFixtures/ORM/channel_with_countries.yaml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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'
|
||||
locales: ['@locale_en', '@locale_pl']
|
||||
color: 'black'
|
||||
enabled: true
|
||||
taxCalculationStrategy: 'order_items_based'
|
||||
countries: ['@country_US', '@country_FR']
|
||||
|
||||
Sylius\Component\Currency\Model\Currency:
|
||||
currency_usd:
|
||||
code: 'USD'
|
||||
|
||||
Sylius\Component\Locale\Model\Locale:
|
||||
locale_en:
|
||||
code: 'en_US'
|
||||
locale_pl:
|
||||
code: 'pl_PL'
|
||||
locale_de:
|
||||
code: 'de_DE'
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"@context": "\/api\/v2\/contexts\/Country",
|
||||
"@id": "\/api\/v2\/shop\/countries",
|
||||
"@type": "hydra:Collection",
|
||||
"hydra:member": [
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/countries\/US",
|
||||
"@type": "Country",
|
||||
"code": "US",
|
||||
"name": "United States",
|
||||
"provinces": [
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/provinces\/US-MI",
|
||||
"@type": "Province",
|
||||
"code": "US-MI",
|
||||
"name": "Minnesota"
|
||||
},
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/provinces\/US-WY",
|
||||
"@type": "Province",
|
||||
"code": "US-WY",
|
||||
"name": "Wyoming"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/countries\/FR",
|
||||
"@type": "Country",
|
||||
"code": "FR",
|
||||
"name": "France",
|
||||
"provinces": []
|
||||
}
|
||||
],
|
||||
"hydra:totalItems": 2
|
||||
}
|
||||
|
|
@ -29,6 +29,17 @@ final class CountriesTest extends JsonApiTestCase
|
|||
$this->assertResponse($response, 'shop/country/get_countries_response', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_gets_only_countries_from_current_channel(): void
|
||||
{
|
||||
$this->loadFixturesFromFiles(['channel_with_countries.yaml', 'country.yaml']);
|
||||
|
||||
$this->client->request(method: 'GET', uri: '/api/v2/shop/countries', server: self::CONTENT_TYPE_HEADER);
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertResponse($response, 'shop/country/get_countries_from_channel_response', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_gets_a_country(): void
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue