[API] Expose menu taxon in Channel Admin API

This commit is contained in:
Mateusz Zalewski 2020-01-12 23:25:28 +01:00
parent b3a2f512bc
commit cdfcb85e5c
No known key found for this signature in database
GPG key ID: 9BECA0BB71612E52
8 changed files with 177 additions and 3 deletions

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Migrations;

View file

@ -231,7 +231,7 @@ final class ChannelContext implements Context
* @Given /^(channel "[^"]+") has menu (taxon "[^"]+")$/
* @Given /^(this channel) has menu (taxon "[^"]+")$/
*/
public function theChannelMenuTaxonIs(ChannelInterface $channel, TaxonInterface $taxon): void
public function channelHasMenuTaxon(ChannelInterface $channel, TaxonInterface $taxon): void
{
$channel->setMenuTaxon($taxon);

View file

@ -113,7 +113,7 @@ final class ManagingChannelsContext implements Context
/**
* @When I change its menu taxon to :menuTaxon
*/
public function iChangeMenuTaxonTo(string $menuTaxon): void
public function iChangeItsMenuTaxonTo(string $menuTaxon): void
{
$this->updatePage->changeMenuTaxon($menuTaxon);
}

View file

@ -6,6 +6,9 @@ Sylius\Component\Core\Model\Channel:
expose: true
type: string
groups: [Detailed]
menuTaxon:
expose: true
groups: [Detailed]
relations:
- rel: self
href:

View file

@ -142,9 +142,10 @@ EOT;
$this->loadFixturesFromFile('resources/locales.yml');
$this->loadFixturesFromFile('resources/currencies.yml');
$this->loadFixturesFromFile('resources/zones.yml');
$this->loadFixturesFromFile('resources/taxons.yml');
$data =
<<<EOT
<<<EOT
{
"code": "android",
"name": "Channel for Android client",
@ -158,6 +159,7 @@ EOT;
"currencies": [
"GBP"
],
"menuTaxon": "mugs",
"color": "ClassicBlue",
"contactEmail": "admin@quickmart.eu",
"skippingShippingStepAllowed": true,

View file

@ -45,6 +45,7 @@
"postcode": {}
}
},
"menuTaxon": {},
"code": {
"errors": [
"Please enter channel code."

View file

@ -9,6 +9,164 @@
"updatedAt": "@string@.isDateTime()",
"enabled": true,
"taxCalculationStrategy": "order_items_based",
"menuTaxon": {
"id": @integer@,
"code": "mugs",
"root": {
"id": @integer@,
"code": "category",
"children": {
"1": {
"id": @integer@,
"code": "stickers",
"children": [],
"left": 4,
"right": 5,
"level": 1,
"position": 1,
"translations": [],
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"2": {
"id": @integer@,
"code": "books",
"children": [],
"left": 6,
"right": 7,
"level": 1,
"position": 2,
"translations": [],
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"3": {
"id": @integer@,
"code": "t-shirts",
"children": [],
"left": 8,
"right": 13,
"level": 1,
"position": 3,
"translations": [],
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
}
},
"left": 1,
"right": 14,
"level": 0,
"position": 0,
"translations": {
"en": {
"locale": "en"
}
},
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"parent": {
"id": @integer@,
"code": "category",
"children": {
"1": {
"id": @integer@,
"code": "stickers",
"children": [],
"left": 4,
"right": 5,
"level": 1,
"position": 1,
"translations": [],
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"2": {
"id": @integer@,
"code": "books",
"children": [],
"left": 6,
"right": 7,
"level": 1,
"position": 2,
"translations": [],
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"3": {
"id": @integer@,
"code": "t-shirts",
"children": [],
"left": 8,
"right": 13,
"level": 1,
"position": 3,
"translations": [],
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
}
},
"left": 1,
"right": 14,
"level": 0,
"position": 0,
"translations": {
"en": {
"locale": "en"
}
},
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"children": [],
"left": 2,
"right": 3,
"level": 1,
"position": 0,
"translations": {
"en": {
"locale": "en"
}
},
"images": [],
"_links": {
"self": {
"href": "@string@"
}
}
},
"_links": {
"self": {
"href": @string@

View file

@ -37,6 +37,7 @@
"postcode": {}
}
},
"menuTaxon": {},
"code": {},
"baseCurrency": {}
}