[API][ChannelPriceHistoryConfig] Upgrade and embed into channel

This commit is contained in:
Jan Goralski 2024-08-15 15:27:24 +02:00 committed by Grzegorz Sadowski
parent 0fc1655371
commit 3fc01a3fad
84 changed files with 660 additions and 865 deletions

View file

@ -1,66 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Tests\Api\Admin;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Tests\Api\JsonApiTestCase;
use Symfony\Component\HttpFoundation\Response;
final class ChannelPriceHistoryConfigTest extends JsonApiTestCase
{
/** @test */
public function it_gets_a_channel_price_history_config(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'taxonomy.yaml']);
$this->client->request(
method: 'GET',
uri: sprintf('/api/v2/admin/channel-price-history-configs/%d', $fixtures['web_price_history_config']->getId()),
server: $this->headerBuilder()->withJsonLdAccept()->withAdminUserAuthorization('api@example.com')->build(),
);
$this->assertResponse(
$this->client->getResponse(),
'admin/channel_price_history_config/get_channel_price_history_config_response',
Response::HTTP_OK,
);
}
/** @test */
public function it_updates_a_channel_price_history_config(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'taxonomy.yaml']);
/** @var TaxonInterface $brandTaxon */
$brandTaxon = $fixtures['brand_taxon'];
$this->client->request(
method: 'PUT',
uri: sprintf('/api/v2/admin/channel-price-history-configs/%d', $fixtures['web_price_history_config']->getId()),
server: $this->headerBuilder()->withJsonLdContentType()->withJsonLdAccept()->withAdminUserAuthorization('api@example.com')->build(),
content: json_encode([
'lowestPriceForDiscountedProductsVisible' => true,
'lowestPriceForDiscountedProductsCheckingPeriod' => 60,
'taxonsExcludedFromShowingLowestPrice' => [
sprintf('/api/v2/admin/taxons/%s', $brandTaxon->getCode()),
],
], \JSON_THROW_ON_ERROR),
);
$this->assertResponse(
$this->client->getResponse(),
'admin/channel_price_history_config/put_channel_price_history_config_response',
Response::HTTP_OK,
);
}
}

View file

@ -24,7 +24,7 @@ final class ProductAttributeValuesTest extends JsonApiTestCase
/** @test */
public function it_gets_attribute_value(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_attribute.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_attribute.yaml']);
$attributeValue = $fixtures['product_attribute_value_checkbox'];
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);

View file

@ -27,7 +27,7 @@ final class ProductVariantsTest extends JsonApiTestCase
public function it_denies_access_to_a_product_variants_list_for_not_authenticated_user(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -44,7 +44,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -66,7 +66,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -91,7 +91,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -145,7 +145,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -179,7 +179,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -217,7 +217,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -255,7 +255,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -290,7 +290,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -327,7 +327,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -376,7 +376,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -443,7 +443,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -486,7 +486,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -521,7 +521,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -560,7 +560,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -601,7 +601,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -625,7 +625,7 @@ final class ProductVariantsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',

View file

@ -37,7 +37,7 @@ final class StatisticsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'statistics.yaml',
'shipping_method.yaml',
'payment_method.yaml',
@ -123,7 +123,7 @@ final class StatisticsTest extends JsonApiTestCase
/** @test */
public function it_does_not_get_statistics_data_for_non_admin_user(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->client->request(method: 'GET', uri: '/api/v2/admin/statistics');
@ -133,7 +133,7 @@ final class StatisticsTest extends JsonApiTestCase
/** @test */
public function it_returns_a_not_found_status_code_if_channel_does_not_exist(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->client->request(
method: 'GET',
@ -157,7 +157,7 @@ final class StatisticsTest extends JsonApiTestCase
*/
public function it_returns_a_validation_error_if_period_is_invalid(array $parameters): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->client->request(
method: 'GET',
@ -188,7 +188,7 @@ final class StatisticsTest extends JsonApiTestCase
array $queryParameters,
array $expectedViolations,
): void {
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->client->request(
method: 'GET',

View file

@ -31,7 +31,7 @@ final class CartTest extends JsonApiTestCase
/** @test */
public function it_creates_empty_cart(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$this->client->request(
method: 'POST',
@ -50,7 +50,7 @@ final class CartTest extends JsonApiTestCase
/** @test */
public function it_creates_empty_cart_with_provided_locale(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$this->client->request(
method: 'POST',
@ -70,7 +70,7 @@ final class CartTest extends JsonApiTestCase
public function it_gets_empty_cart(): void
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$tokenValue = $this->pickUpCart();
@ -84,7 +84,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -103,7 +103,7 @@ final class CartTest extends JsonApiTestCase
public function it_adds_item_to_order(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -133,7 +133,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_to_add_item_to_order_with_missing_fields(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -161,7 +161,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -184,7 +184,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -204,7 +204,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -223,7 +223,7 @@ final class CartTest extends JsonApiTestCase
public function it_updates_item_quantity_in_cart(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -255,7 +255,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_to_update_item_quantity_in_cart_with_missing_fields(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -286,7 +286,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_to_update_item_quantity_if_invalid_id_item(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -309,7 +309,7 @@ final class CartTest extends JsonApiTestCase
public function it_updates_cart(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -357,7 +357,7 @@ final class CartTest extends JsonApiTestCase
/** @test */
public function it_does_not_allow_update_without_items(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$tokenValue = $this->pickUpCart();
@ -382,7 +382,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_update_without_required_billing_address(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
]);
@ -421,7 +421,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_update_without_required_shipping_address(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
]);
@ -460,7 +460,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_update_with_invalid_data(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
]);
@ -508,7 +508,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -31,7 +31,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_does_not_allow_to_complete_order_in_cart_state(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
]);
@ -57,7 +57,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_does_not_allow_to_complete_order_in_addressed_state(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'shipping_method.yaml',
]);
@ -85,7 +85,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_does_not_allow_to_complete_order_in_shipping_selected_state(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'shipping_method.yaml',
'payment_method.yaml',
@ -115,7 +115,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_does_not_allow_to_complete_order_in_shipping_skipped_state(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'shipping_method.yaml',
'payment_method.yaml',
@ -144,7 +144,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_completes_checkout_with_shippable_and_non_shippable_items_if_all_checkout_steps_have_been_completed(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'shipping_method.yaml',
'payment_method.yaml',
@ -174,7 +174,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_completes_checkout_with_non_shippable_items_without_shipping_method_assigned(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'shipping_method.yaml',
'payment_method.yaml',
@ -202,7 +202,7 @@ final class CompletionTest extends JsonApiTestCase
public function it_completes_checkout_with_free_non_shippable_items_without_shipping_method_and_payment_method_assigned(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
]);

View file

@ -33,7 +33,7 @@ final class PaymentMethodTest extends JsonApiTestCase
public function it_selects_payment_method(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -67,7 +67,7 @@ final class PaymentMethodTest extends JsonApiTestCase
public function it_does_not_allow_to_select_payment_method_to_non_existing_payment(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -103,7 +103,7 @@ final class PaymentMethodTest extends JsonApiTestCase
public function it_does_not_allow_to_select_payment_method_with_missing_fields(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -133,7 +133,7 @@ final class PaymentMethodTest extends JsonApiTestCase
public function it_does_not_allow_to_select_payment_method_with_invalid_payment_method(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -33,7 +33,7 @@ final class ShippingMethodTest extends JsonApiTestCase
public function it_selects_shipping_method(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -66,7 +66,7 @@ final class ShippingMethodTest extends JsonApiTestCase
public function it_does_not_allow_to_select_shipping_method_to_non_existing_shipment(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -101,7 +101,7 @@ final class ShippingMethodTest extends JsonApiTestCase
public function it_does_not_allow_to_select_shipping_method_with_missing_fields(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -130,7 +130,7 @@ final class ShippingMethodTest extends JsonApiTestCase
public function it_does_not_allow_to_select_shipping_method_with_invalid_shipping_method(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -38,7 +38,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -60,7 +60,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'customer.yaml',
@ -83,7 +83,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'customer.yaml',
@ -118,7 +118,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -141,7 +141,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'authentication/customer.yaml',
@ -162,7 +162,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'customer.yaml',
@ -202,7 +202,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'customer.yaml',
@ -245,7 +245,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'customer.yaml',
@ -266,7 +266,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'customer.yaml',
@ -289,7 +289,7 @@ final class OrdersTest extends JsonApiTestCase
public function it_prevents_visitors_from_getting_the_adjustments_of_a_user_order(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'authentication/customer.yaml',
@ -310,7 +310,7 @@ final class OrdersTest extends JsonApiTestCase
public function it_prevents_visitors_from_getting_the_item_adjustments_of_a_user_order(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'authentication/customer.yaml',
@ -331,7 +331,7 @@ final class OrdersTest extends JsonApiTestCase
public function it_returns_nothing_if_a_user_tries_to_get_the_order_item_adjustments_of_another_user(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'authentication/customer.yaml',
@ -357,7 +357,7 @@ final class OrdersTest extends JsonApiTestCase
/** @test */
public function it_gets_order_item_adjustments(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = $this->pickUpCart();

View file

@ -21,7 +21,7 @@ final class ProductAttributeValuesTest extends JsonApiTestCase
/** @test */
public function it_gets_attribute_value(): void
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'product/product_attribute.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product_attribute.yaml']);
$attributeValue = $fixtures['product_attribute_value_checkbox'];
$this->client->request(

View file

@ -77,7 +77,7 @@ final class ProductVariantsTest extends JsonApiTestCase
public function it_returns_product_variant_with_applied_promotion(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'catalog_promotion/catalog_promotion.yaml',
'catalog_promotion/product_variant.yaml',
]);

View file

@ -25,7 +25,7 @@ final class ShopUsersTest extends JsonApiTestCase
/** @test */
public function it_sends_shop_user_password_reset_email(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'authentication/shop_user.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/shop_user.yaml']);
$this->client->request(
method: Request::METHOD_POST,
@ -43,7 +43,7 @@ final class ShopUsersTest extends JsonApiTestCase
/** @test */
public function it_resets_shop_user_password_with_valid_token(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'authentication/shop_user_with_reset_password_token.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/shop_user_with_reset_password_token.yaml']);
$validToken = 'valid_token';
@ -65,7 +65,7 @@ final class ShopUsersTest extends JsonApiTestCase
/** @test */
public function it_prevents_shop_user_from_resetting_password_with_invalid_token(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'authentication/shop_user_with_reset_password_token.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/shop_user_with_reset_password_token.yaml']);
$validToken = 'invalid_token';
@ -87,7 +87,7 @@ final class ShopUsersTest extends JsonApiTestCase
/** @test */
public function it_prevents_shop_user_from_resetting_password_with_expired_token(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'authentication/shop_user_with_expired_reset_password_token.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/shop_user_with_expired_reset_password_token.yaml']);
$validToken = 'valid_token';

View file

@ -10,7 +10,7 @@ Feature: Specifying the lowest price for discounted products checking period whi
And the store operates in "United States" and "Poland"
And I am logged in as an administrator
@todo @api @ui
@api @ui
Scenario: Adding a new channel without specifying the lowest price for discounted products checking period
When I want to create a new channel
And I specify its code as "MOBILE"
@ -23,7 +23,7 @@ Feature: Specifying the lowest price for discounted products checking period whi
Then I should be notified that it has been successfully created
And the "Mobile" channel should have the lowest price for discounted products checking period set to 30 days
@todo @api @ui
@api @ui
Scenario: Adding a new channel with a specified lowest price for discounted products checking period
When I want to create a new channel
And I specify its code as "MOBILE"
@ -37,7 +37,7 @@ Feature: Specifying the lowest price for discounted products checking period whi
Then I should be notified that it has been successfully created
And the "Mobile" channel should have the lowest price for discounted products checking period set to 15 days
@todo @api @ui
@api @ui
Scenario: Being prevented from creating a new channel with the lowest price for discounted products checking period equal to zero
When I want to create a new channel
And I specify its code as "MOBILE"
@ -50,7 +50,7 @@ Feature: Specifying the lowest price for discounted products checking period whi
And I try to add it
Then I should be notified that the lowest price for discounted products checking period must be greater than 0
@todo @api @ui
@api @ui
Scenario: Being prevented from creating a new channel with a negative lowest price for discounted products checking period
When I want to create a new channel
And I specify its code as "MOBILE"
@ -64,7 +64,7 @@ Feature: Specifying the lowest price for discounted products checking period whi
And I try to add it
Then I should be notified that the lowest price for discounted products checking period must be greater than 0
@todo @api @ui
@api @ui
Scenario: Being prevented from creating a new channel with a too big lowest price for discounted products checking period
When I want to create a new channel
And I specify its code as "MOBILE"

View file

@ -10,7 +10,7 @@ Feature: Choosing whether to show the lowest product price or not while creating
And the store operates in "United States" and "Poland"
And I am logged in as an administrator
@todo @api @ui
@api @ui
Scenario: Adding a new channel with lowest price before the product has been discounted enabled by default
When I want to create a new channel
And I specify its code as "MOBILE"
@ -23,7 +23,7 @@ Feature: Choosing whether to show the lowest product price or not while creating
Then I should be notified that it has been successfully created
And the "Mobile" channel should have the lowest price of discounted products prior to the current discount enabled
@todo @api @ui
@api @ui
Scenario: Adding a new channel with lowest price before the product has been discounted enabled
When I want to create a new channel
And I specify its code as "MOBILE"
@ -37,7 +37,7 @@ Feature: Choosing whether to show the lowest product price or not while creating
Then I should be notified that it has been successfully created
And the "Mobile" channel should have the lowest price of discounted products prior to the current discount enabled
@todo @api @ui
@api @ui
Scenario: Adding a new channel with lowest price before the product has been discounted disabled
When I want to create a new channel
And I specify its code as "MOBILE"

View file

@ -9,7 +9,7 @@ Feature: Specifying the lowest price for discounted products checking period whi
And this channel has 15 days set as the lowest price for discounted products checking period
And I am logged in as an administrator
@no-api @ui
@api @ui
Scenario: Changing the lowest price for discounted products checking period
When I want to modify a channel "EU"
And I specify 30 days as the lowest price for discounted products checking period
@ -17,52 +17,23 @@ Feature: Specifying the lowest price for discounted products checking period whi
Then I should be notified that it has been successfully edited
And its lowest price for discounted products checking period should be set to 30 days
@no-api @ui
@api @ui
Scenario: Being prevented from changing the lowest price for discounted products checking period to zero
When I want to modify a channel "EU"
And I specify 0 days as the lowest price for discounted products checking period
And I try to save my changes
Then I should be notified that the lowest price for discounted products checking period must be greater than 0
@no-api @ui
@api @ui
Scenario: Being prevented from changing the lowest price for discounted products checking period to a negative value
When I want to modify a channel "EU"
And I specify -10 days as the lowest price for discounted products checking period
And I try to save my changes
Then I should be notified that the lowest price for discounted products checking period must be greater than 0
@no-api @ui
@api @ui
Scenario: Being prevented from changing the lowest price for discounted products checking period to a too big value
When I want to modify a channel "EU"
And I specify 99999999999 days as the lowest price for discounted products checking period
And I try to save my changes
Then I should be notified that the lowest price for discounted products checking period must be lower
@todo @api @no-ui
Scenario: Changing the lowest price for discounted products checking period
When I want to modify the price history config of channel "EU"
And I change the lowest price for discounted products checking period to 30 days
And I save my changes
Then I should be notified that it has been successfully edited
And its lowest price for discounted products checking period should be set to 30 days
@todo @api @no-ui
Scenario: Being prevented from changing the lowest price for discounted products checking period to zero
When I want to modify the price history config of channel "EU"
And I change the lowest price for discounted products checking period to 0 days
And I try to save my changes
Then I should be notified that the lowest price for discounted products checking period must be greater than 0
@todo @api @no-ui
Scenario: Being prevented from changing the lowest price for discounted products checking period to a negative value
When I want to modify the price history config of channel "EU"
And I change the lowest price for discounted products checking period to -10 days
And I try to save my changes
Then I should be notified that the lowest price for discounted products checking period must be greater than 0
@todo @api @no-ui
Scenario: Being prevented from changing the lowest price for discounted products checking period to a too big value
When I want to modify the price history config of channel "EU"
And I change the lowest price for discounted products checking period to 99999999999 days
And I try to save my changes
Then I should be notified that the lowest price for discounted products checking period must be lower

View file

@ -11,7 +11,7 @@ Feature: Choosing whether to show the lowest product price or not while editing
And the channel "US Channel" has showing the lowest price of discounted products disabled
And I am logged in as an administrator
@no-api @ui
@api @ui
Scenario: Enabling showing the lowest price of discounted products on a channel
When I want to modify a channel "US Channel"
And I enable showing the lowest price of discounted products
@ -19,26 +19,10 @@ Feature: Choosing whether to show the lowest product price or not while editing
Then I should be notified that it has been successfully edited
And the "US Channel" channel should have the lowest price of discounted products prior to the current discount enabled
@no-api @ui
@api @ui
Scenario: Disabling showing the lowest price of discounted products on a channel
When I want to modify a channel "EU Channel"
And I disable showing the lowest price of discounted products
And I save my changes
Then I should be notified that it has been successfully edited
And the "EU Channel" channel should have the lowest price of discounted products prior to the current discount disabled
@todo @api @no-ui
Scenario: Enabling showing the lowest price of discounted products on a channel
When I want to modify the price history config of channel "US Channel"
And I change showing of the lowest price of discounted products to be enabled
And I save my changes
Then I should be notified that it has been successfully edited
And the "US Channel" channel should have the lowest price of discounted products prior to the current discount enabled
@todo @api @no-ui
Scenario: Disabling showing the lowest price of discounted products on a channel
When I want to modify the price history config of channel "EU Channel"
And I change showing of the lowest price of discounted products to be disabled
And I save my changes
Then I should be notified that it has been successfully edited
And the "EU Channel" channel should have the lowest price of discounted products prior to the current discount disabled

View file

@ -11,7 +11,7 @@ Feature: Editing menu taxon on channel
And channel "Web Store" has menu taxon "Clothes"
And I am logged in as an administrator
@todo @api @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Editing menu taxon on the channel
When I want to modify a channel "Web Store"
And I change its menu taxon to "Guns"

View file

@ -9,7 +9,7 @@ Feature: Excluding chosen taxons from displaying the lowest price of discounted
And the store classifies its products as "T-Shirts", "Caps" and "Sweaters"
And I am logged in as an administrator
@no-api @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Excluding a singular taxon from displaying the lowest price of discounted products
When I want to modify a channel "Poland"
And I exclude the "T-Shirts" taxon from showing the lowest price of discounted products
@ -17,7 +17,7 @@ Feature: Excluding chosen taxons from displaying the lowest price of discounted
Then I should be notified that it has been successfully edited
And this channel should have "T-Shirts" taxon excluded from displaying the lowest price of discounted products
@no-api @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Excluding multiple taxons from displaying the lowest price of discounted products
When I want to modify a channel "Poland"
And I exclude the "T-Shirts" and "Caps" taxons from showing the lowest price of discounted products
@ -25,7 +25,7 @@ Feature: Excluding chosen taxons from displaying the lowest price of discounted
Then I should be notified that it has been successfully edited
And this channel should have "T-Shirts" and "Caps" taxons excluded from displaying the lowest price of discounted products
@no-api @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Removing excluded taxon from displaying the lowest price of discounted products
Given the channel "Poland" has "T-Shirts" and "Caps" taxons excluded from showing the lowest price of discounted products
When I want to modify this channel
@ -34,19 +34,3 @@ Feature: Excluding chosen taxons from displaying the lowest price of discounted
Then I should be notified that it has been successfully edited
And this channel should have "Caps" taxon excluded from displaying the lowest price of discounted products
And this channel should not have "T-Shirts" taxon excluded from displaying the lowest price of discounted products
@todo @api @no-ui
Scenario: Excluding a singular taxon from displaying the lowest price of discounted products
When I want to modify the price history config of channel "Poland"
And I exclude the "T-Shirts" taxon from showing the lowest price of discounted products
And I save my changes
Then I should be notified that it has been successfully edited
And this channel should have "T-Shirts" taxon excluded from displaying the lowest price of discounted products
@todo @api @no-ui
Scenario: Excluding multiple taxons from displaying the lowest price of discounted products
When I want to modify the price history config of channel "Poland"
And I exclude the "T-Shirts" and "Caps" taxons from showing the lowest price of discounted products
And I save my changes
Then I should be notified that it has been successfully edited
And this channel should have "T-Shirts" and "Caps" taxons excluded from displaying the lowest price of discounted products

View file

@ -8,7 +8,7 @@ Feature: Selecting default tax zone for a channel
Given the store operates on a single channel in "United States"
And I am logged in as an administrator
@todo @api @ui
@api @ui
Scenario: Adding a new channel with default tax zone
When I want to create a new channel
And I specify its code as "MOBILE"
@ -22,7 +22,7 @@ Feature: Selecting default tax zone for a channel
Then I should be notified that it has been successfully created
And the default tax zone for the "Mobile store" channel should be "United States"
@todo @api @ui
@api @ui
Scenario: Selecting default tax zone for existing channel
Given the store operates on a channel named "Web store"
When I want to modify this channel
@ -31,7 +31,7 @@ Feature: Selecting default tax zone for a channel
Then I should be notified that it has been successfully edited
And the default tax zone for the "Web store" channel should be "United States"
@todo @api @ui
@api @ui
Scenario: Removing existing channel default tax zone
Given the store operates on a channel named "Web store"
And its default tax zone is zone "US"

View file

@ -0,0 +1,195 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Behat\Context\Api\Admin;
use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Service\Converter\IriConverterInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Webmozart\Assert\Assert;
final class ManagingChannelPriceHistoryConfigContext implements Context
{
public function __construct(
private ApiClientInterface $client,
private ResponseCheckerInterface $responseChecker,
private IriConverterInterface $iriConverter,
private SharedStorageInterface $sharedStorage,
) {
}
/**
* @When /^I (enable|disable) showing the lowest price of discounted products$/
*/
public function iEnableShowingTheLowestPriceOfDiscountedProducts(string $visible): void
{
$this->client->addRequestData(
'channelPriceHistoryConfig',
['lowestPriceForDiscountedProductsVisible' => $visible === 'enable'],
);
}
/**
* @When /^I specify (-?\d+) days as the lowest price for discounted products checking period$/
*/
public function iSpecifyDaysAsTheLowestPriceForDiscountedProductsCheckingPeriod(int $days): void
{
$this->client->addRequestData(
'channelPriceHistoryConfig',
['lowestPriceForDiscountedProductsCheckingPeriod' => $days],
);
}
/**
* @When I exclude the :taxon taxon from showing the lowest price of discounted products
*/
public function iExcludeTheTaxonFromShowingTheLowestPriceOfDiscountedProducts(TaxonInterface $taxon): void
{
$this->iExcludeTheTaxonsFromShowingTheLowestPriceOfDiscountedProducts([$taxon]);
}
/**
* @When I remove the :taxon taxon from excluded taxons from showing the lowest price of discounted products
*/
public function iRemoveTheTaxonFromExcludedTaxonsFromShowingTheLowestPriceOfDiscountedProducts(TaxonInterface $taxon): void
{
/** @var ChannelInterface $channel */
$channel = $this->sharedStorage->get('channel');
$leftTaxons = [];
foreach ($channel->getChannelPriceHistoryConfig()->getTaxonsExcludedFromShowingLowestPrice() as $excludedTaxon) {
if ($excludedTaxon->getId() !== $taxon->getId()) {
$leftTaxons[] = $excludedTaxon;
}
}
$this->iExcludeTheTaxonsFromShowingTheLowestPriceOfDiscountedProducts($leftTaxons);
}
/**
* @When /^I exclude the ("[^"]+" and "[^"]+" taxons) from showing the lowest price of discounted products$/
*/
public function iExcludeTheTaxonsFromShowingTheLowestPriceOfDiscountedProducts(iterable $taxons): void
{
$taxonsIris = [];
foreach ($taxons as $taxon) {
$taxonsIris[] = $this->iriConverter->getIriFromResource($taxon);
}
$this->client->addRequestData(
'channelPriceHistoryConfig',
['taxonsExcludedFromShowingLowestPrice' => $taxonsIris],
);
}
/**
* @Then /^the "[^"]+" channel should have the lowest price of discounted products prior to the current discount (enabled|disabled)$/
*/
public function theChannelShouldHaveTheLowestPriceOfDiscountedProductsPriorToTheCurrentDiscountEnabledOrDisabled(
string $visible,
): void {
Assert::same(
$this->getChannelPricingFieldFromLastResponse('lowestPriceForDiscountedProductsVisible'),
$visible === 'enabled',
);
}
/**
* @Then /^the "[^"]+" channel should have the lowest price for discounted products checking period set to (\d+) days$/
* @Then its lowest price for discounted products checking period should be set to :days days
*/
public function theChannelShouldHaveTheLowestPriceForDiscountedProductsCheckingPeriodSetToDays(int $days): void
{
Assert::same(
$this->getChannelPricingFieldFromLastResponse('lowestPriceForDiscountedProductsCheckingPeriod'),
$days,
);
}
/**
* @Then I should be notified that the lowest price for discounted products checking period must be greater than 0
*/
public function iShouldBeNotifiedThatTheLowestPriceForDiscountedProductsCheckingPeriodMustBeGreaterThanZero(): void
{
Assert::true($this->responseChecker->hasViolationWithMessage(
$this->client->getLastResponse(),
'Value must be greater than 0',
'channelPriceHistoryConfig.lowestPriceForDiscountedProductsCheckingPeriod',
));
}
/**
* @Then I should be notified that the lowest price for discounted products checking period must be lower
*/
public function iShouldBeNotifiedThatTheLowestPriceForDiscountedProductsCheckingPeriodMustBeLower(): void
{
Assert::true($this->responseChecker->hasViolationWithMessage(
$this->client->getLastResponse(),
'Value must be less than 2147483647',
'channelPriceHistoryConfig.lowestPriceForDiscountedProductsCheckingPeriod',
));
}
/**
* @Then /^this channel should have ("[^"]+" taxon) excluded from displaying the lowest price of discounted products$/
*/
public function thisChannelShouldHaveTaxonExcludedFromDisplayingTheLowestPriceOfDiscountedProducts(
TaxonInterface $taxon,
): void {
$this->thisChannelShouldHaveTaxonsExcludedFromDisplayingTheLowestPriceOfDiscountedProducts([$taxon]);
}
/**
* @Then /^this channel should have ("([^"]+)" and "([^"]+)" taxons) excluded from displaying the lowest price of discounted products$/
*/
public function thisChannelShouldHaveTaxonsExcludedFromDisplayingTheLowestPriceOfDiscountedProducts(
iterable $taxons,
): void {
$excludedTaxons = $this->getChannelPricingFieldFromLastResponse('taxonsExcludedFromShowingLowestPrice', []);
foreach ($taxons as $taxon) {
Assert::true($this->isResourceAdminIriInArray($taxon, $excludedTaxons));
}
}
/**
* @Then /^this channel should not have ("[^"]+" taxon) excluded from displaying the lowest price of discounted products$/
*/
public function thisChannelShouldNotHaveTaxonExcludedFromDisplayingTheLowestPriceOfDiscountedProducts(
TaxonInterface $taxon,
): void {
$excludedTaxons = $this->getChannelPricingFieldFromLastResponse('taxonsExcludedFromShowingLowestPrice', []);
Assert::false($this->isResourceAdminIriInArray($taxon, $excludedTaxons));
}
private function getChannelPricingFieldFromLastResponse(string $field, ?array $default = null): bool|int|string|array|null
{
return $this->responseChecker->getValue(
$this->client->getLastResponse(),
'channelPriceHistoryConfig',
)[$field] ?? $default;
}
private function isResourceAdminIriInArray(ResourceInterface $resource, array $iris): bool
{
$iri = $this->iriConverter->getIriFromResourceInSection($resource, 'admin');
return in_array($iri, $iris, true);
}
}

View file

@ -1,214 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Behat\Context\Api\Admin;
use ApiPlatform\Api\IriConverterInterface;
use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Context\Api\Resources;
use Sylius\Behat\Service\Converter\SectionAwareIriConverterInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Webmozart\Assert\Assert;
final class ManagingChannelPriceHistoryConfigsContext implements Context
{
public function __construct(
private SharedStorageInterface $sharedStorage,
private ApiClientInterface $client,
private ResponseCheckerInterface $responseChecker,
private IriConverterInterface $iriConverter,
private SectionAwareIriConverterInterface $sectionAwareIriConverter,
) {
}
/**
* @When /^I want to modify the price history config of (channel "[^"]+")$/
*/
public function iWantToModifyThePriceHistoryConfigOfChannel(ChannelInterface $channel): void
{
$this->sharedStorage->set('channel', $channel);
$this->client->buildUpdateRequest(
Resources::CHANNEL_PRICE_HISTORY_CONFIGS,
(string) $channel->getChannelPriceHistoryConfig()->getId(),
);
}
/**
* @When /^I change showing of the lowest price of discounted products to be (enabled|disabled)$/
*/
public function iChangeShowingOfTheLowestPriceOfDiscountedProducts(string $visible): void
{
$this->client->addRequestData(
'lowestPriceForDiscountedProductsVisible',
$visible === 'enabled',
);
}
/**
* @When /^I change the lowest price for discounted products checking period to (-?\d+) days$/
*/
public function iChangeTheLowestPriceForDiscountedProductsCheckingPeriodToDays(int $days): void
{
$this->client->addRequestData('lowestPriceForDiscountedProductsCheckingPeriod', $days);
}
/**
* @When I exclude the :taxon taxon from showing the lowest price of discounted products
*/
public function iExcludeTheTaxonFromShowingTheLowestPriceOfDiscountedProducts(TaxonInterface $taxon): void
{
$this->iExcludeTheTaxonsFromShowingTheLowestPriceOfDiscountedProducts([$taxon]);
}
/**
* @When /^I exclude the ("[^"]+" and "[^"]+" taxons) from showing the lowest price of discounted products$/
*/
public function iExcludeTheTaxonsFromShowingTheLowestPriceOfDiscountedProducts(iterable $taxons): void
{
$taxonsIris = [];
foreach ($taxons as $taxon) {
$taxonsIris[] = $this->iriConverter->getIriFromResource($taxon);
}
$this->client->addRequestData('taxonsExcludedFromShowingLowestPrice', $taxonsIris);
}
/**
* @Then /^the ("[^"]+" channel) should have the lowest price of discounted products prior to the current discount (enabled|disabled)$/
*/
public function theChannelShouldHaveTheLowestPriceOfDiscountedProductsPriorToTheCurrentDiscountEnabledOrDisabled(
ChannelInterface $channel,
string $visible,
): void {
$lowestPriceForDiscountedProductsVisible = $this->responseChecker->getValue(
$this->client->show(
Resources::CHANNEL_PRICE_HISTORY_CONFIGS,
(string) $channel->getChannelPriceHistoryConfig()->getId(),
),
'lowestPriceForDiscountedProductsVisible',
);
Assert::same($lowestPriceForDiscountedProductsVisible, $visible === 'enabled');
}
/**
* @Then /^the ("[^"]+" channel) should have the lowest price for discounted products checking period set to (\d+) days$/
* @Then /^(its) lowest price for discounted products checking period should be set to (\d+) days$/
*/
public function theChannelShouldHaveTheLowestPriceForDiscountedProductsCheckingPeriodSetToDays(
ChannelInterface $channel,
int $days,
): void {
$lowestPriceForDiscountedProductsCheckingPeriod = $this->responseChecker->getValue(
$this->client->show(
Resources::CHANNEL_PRICE_HISTORY_CONFIGS,
(string) $channel->getChannelPriceHistoryConfig()->getId(),
),
'lowestPriceForDiscountedProductsCheckingPeriod',
);
Assert::same($lowestPriceForDiscountedProductsCheckingPeriod, $days);
}
/**
* @Then I should be notified that the lowest price for discounted products checking period must be greater than 0
*/
public function iShouldBeNotifiedThatTheLowestPriceForDiscountedProductsCheckingPeriodMustBeGreaterThanZero(): void
{
Assert::true($this->responseChecker->hasViolationWithMessage(
$this->client->getLastResponse(),
'Value must be greater than 0',
'lowestPriceForDiscountedProductsCheckingPeriod',
));
}
/**
* @Then I should be notified that the lowest price for discounted products checking period must be lower
*/
public function iShouldBeNotifiedThatTheLowestPriceForDiscountedProductsCheckingPeriodMustBeLower(): void
{
Assert::true($this->responseChecker->hasViolationWithMessage(
$this->client->getLastResponse(),
'Value must be less than 2147483647',
'lowestPriceForDiscountedProductsCheckingPeriod',
));
}
/**
* @Then /^(this channel) should have ("[^"]+" taxon) excluded from displaying the lowest price of discounted products$/
*/
public function thisChannelShouldHaveTaxonExcludedFromDisplayingTheLowestPriceOfDiscountedProducts(
ChannelInterface $channel,
TaxonInterface $taxon,
): void {
$excludedTaxons = $this->responseChecker->getValue(
$this->client->show(
Resources::CHANNEL_PRICE_HISTORY_CONFIGS,
(string) $channel->getChannelPriceHistoryConfig()->getId(),
),
'taxonsExcludedFromShowingLowestPrice',
);
Assert::true($this->isResourceAdminIriInArray($taxon, $excludedTaxons));
}
/**
* @Then /^(this channel) should have ("([^"]+)" and "([^"]+)" taxons) excluded from displaying the lowest price of discounted products$/
*/
public function thisChannelShouldHaveTaxonsExcludedFromDisplayingTheLowestPriceOfDiscountedProducts(
ChannelInterface $channel,
iterable $taxons,
): void {
$excludedTaxons = $this->responseChecker->getValue(
$this->client->show(
Resources::CHANNEL_PRICE_HISTORY_CONFIGS,
(string) $channel->getChannelPriceHistoryConfig()->getId(),
),
'taxonsExcludedFromShowingLowestPrice',
);
foreach ($taxons as $taxon) {
Assert::true($this->isResourceAdminIriInArray($taxon, $excludedTaxons));
}
}
/**
* @Then /^(this channel) should not have ("[^"]+" taxon) excluded from displaying the lowest price of discounted products$/
*/
public function thisChannelShouldNotHaveTaxonExcludedFromDisplayingTheLowestPriceOfDiscountedProducts(
ChannelInterface $channel,
TaxonInterface $taxon,
): void {
$excludedTaxons = (array) $this->responseChecker->getValue(
$this->client->show(
Resources::CHANNEL_PRICE_HISTORY_CONFIGS,
(string) $channel->getChannelPriceHistoryConfig()->getId(),
),
'taxonsExcludedFromShowingLowestPrice',
);
Assert::false($this->isResourceAdminIriInArray($taxon, $excludedTaxons));
}
private function isResourceAdminIriInArray(ResourceInterface $resource, array $iris): bool
{
$iri = $this->sectionAwareIriConverter->getIriFromResourceInSection($resource, 'admin');
return in_array($iri, $iris, true);
}
}

View file

@ -347,28 +347,6 @@ final class ManagingChannelsContext implements Context
$this->client->buildUpdateRequest(Resources::CHANNELS, $channel->getCode());
}
/**
* @When /^I (enable|disable) showing the lowest price of discounted products$/
*/
public function iEnableShowingTheLowestPriceOfDiscountedProducts(string $visible): void
{
$this->client->addRequestData(
'channelPriceHistoryConfig',
['lowestPriceForDiscountedProductsVisible' => $visible === 'enable'],
);
}
/**
* @When /^I specify (-?\d+) days as the lowest price for discounted products checking period$/
*/
public function iSpecifyDaysAsTheLowestPriceForDiscountedProductsCheckingPeriod(int $days): void
{
$this->client->addRequestData(
'channelPriceHistoryConfig',
['lowestPriceForDiscountedProductsCheckingPeriod' => $days],
);
}
/**
* @When /^I specify its ([^"]+) as a too long string$/
*/

View file

@ -16,10 +16,6 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<imports>
<!-- <import resource="api/**/*.xml" />-->
<import resource="api/admin.xml" />
<import resource="api/common.xml" />
<import resource="api/email.xml" />
<import resource="api/shop.xml" />
<import resource="api/**/*.xml" />
</imports>
</container>

View file

@ -316,5 +316,12 @@
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="sylius.behat.clock" />-->
<!-- </service>-->
<service id="Sylius\Behat\Context\Api\Admin\ManagingChannelPriceHistoryConfigContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.symfony.iri_converter" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
</services>
</container>

View file

@ -30,7 +30,7 @@ default:
- sylius.behat.context.api.admin.response
- sylius.behat.context.api.admin.save
- Sylius\Behat\Context\Api\Admin\ManagingChannelsBillingDataContext
# - Sylius\Behat\Context\Api\Admin\ManagingChannelPriceHistoryConfigsContext - todo: to be uncommented after ChannelPriceHistoryConfig upgrade
- Sylius\Behat\Context\Api\Admin\ManagingChannelPriceHistoryConfigContext
filters:
tags: "@managing_channels&&@api"

View file

@ -80,5 +80,5 @@
<property resource="Sylius\Component\Core\Model\Channel" name="shippingAddressInCheckoutRequired" writable="true" readable="true" />
<property resource="Sylius\Component\Core\Model\Channel" name="shopBillingData" writable="true" genId="false"/>
<property resource="Sylius\Component\Core\Model\Channel" name="menuTaxon" writable="true" readable="true" />
<property resource="Sylius\Component\Core\Model\Channel" name="channelPriceHistoryConfig" readable="true" />
<property resource="Sylius\Component\Core\Model\Channel" name="channelPriceHistoryConfig" writable="true" genId="false"/>
</properties>

View file

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
This file is part of the Sylius package.
(c) Sylius Sp. z o.o.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<resources
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd"
>
<resource class="Sylius\Component\Core\Model\ChannelPriceHistoryConfig" shortName="ChannelPriceHistoryConfig">
<validationContext>
<values>
<value name="groups">
<values>
<value>sylius</value>
</values>
</value>
</values>
</validationContext>
<operations>
<operation class="ApiPlatform\Metadata\Get" routePrefix="admin" >
<normalizationContext>
<values>
<value name="groups">
<values>
<value>sylius:admin:channel_price_history_config:show</value>
</values>
</value>
</values>
</normalizationContext>
</operation>
</operations>
</resource>
</resources>

View file

@ -1,56 +0,0 @@
<?xml version="1.0" ?>
<!--
This file is part of the Sylius package.
(c) Sylius Sp. z o.o.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.channel_price_history_config.class%" shortName="ChannelPriceHistoryConfig">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<collectionOperations />
<itemOperations>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin:channel_price_history_config:show</attribute>
<attribute>sylius:admin:channel_price_history_config:show</attribute>
</attribute>
</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">
<attribute>admin:channel_price_history_config:update</attribute>
<attribute>sylius:admin:channel_price_history_config:update</attribute>
</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin:channel_price_history_config:show</attribute>
<attribute>sylius:admin:channel_price_history_config:show</attribute>
</attribute>
</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />
<property name="lowestPriceForDiscountedProductsCheckingPeriod" readable="true" writable="true" />
<property name="lowestPriceForDiscountedProductsVisible" readable="true" writable="true" />
<property name="taxonsExcludedFromShowingLowestPrice" readable="true" writable="true" />
</resource>
</resources>

View file

@ -16,33 +16,23 @@
xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
>
<class name="Sylius\Component\Core\Model\ChannelPriceHistoryConfig">
<attribute name="id">
<group>admin:channel_price_history_config:show</group>
<group>sylius:admin:channel_price_history_config:show</group>
</attribute>
<attribute name="lowestPriceForDiscountedProductsVisible">
<group>admin:channel:create</group>
<group>sylius:admin:channel:index</group>
<group>sylius:admin:channel:create</group>
<group>admin:channel_price_history_config:update</group>
<group>sylius:admin:channel_price_history_config:update</group>
<group>admin:channel_price_history_config:show</group>
<group>sylius:admin:channel_price_history_config:show</group>
<group>sylius:admin:channel:update</group>
<group>sylius:admin:channel:show</group>
</attribute>
<attribute name="lowestPriceForDiscountedProductsCheckingPeriod">
<group>admin:channel:create</group>
<group>sylius:admin:channel:index</group>
<group>sylius:admin:channel:create</group>
<group>admin:channel_price_history_config:update</group>
<group>sylius:admin:channel_price_history_config:update</group>
<group>admin:channel_price_history_config:show</group>
<group>sylius:admin:channel_price_history_config:show</group>
<group>sylius:admin:channel:update</group>
<group>sylius:admin:channel:show</group>
</attribute>
<attribute name="taxonsExcludedFromShowingLowestPrice">
<group>admin:channel:create</group>
<group>sylius:admin:channel:index</group>
<group>sylius:admin:channel:create</group>
<group>admin:channel_price_history_config:update</group>
<group>sylius:admin:channel_price_history_config:update</group>
<group>admin:channel_price_history_config:show</group>
<group>sylius:admin:channel_price_history_config:show</group>
<group>sylius:admin:channel:update</group>
<group>sylius:admin:channel:show</group>
</attribute>
</class>
</serializer>

View file

@ -127,13 +127,11 @@
<tag name="serializer.normalizer"/>
</service>
<!-- <service id="Sylius\Bundle\ApiBundle\Serializer\ChannelPriceHistoryConfigDenormalizer">-->
<!-- <argument type="service" id="api_platform.symfony.iri_converter" />-->
<!-- <argument type="service" id="sylius.factory.channel_price_history_config" />-->
<!-- <argument type="service" id="Sylius\Bundle\ApiBundle\Validator\ResourceInputDataPropertiesValidatorInterface" />-->
<!-- <argument>%sylius.form.type.channel_price_history_config.validation_groups%</argument>-->
<!-- <tag name="serializer.normalizer" priority="64" />-->
<!-- </service>-->
<service id="sylius_api.denormalizer.channel_price_history_config" class="Sylius\Bundle\ApiBundle\Serializer\Denormalizer\ChannelPriceHistoryConfigDenormalizer">
<argument type="service" id="api_platform.symfony.iri_converter" />
<argument type="service" id="sylius.factory.channel_price_history_config" />
<tag name="serializer.normalizer" priority="64" />
</service>
<service id="Sylius\Bundle\ApiBundle\Serializer\ChannelDenormalizer">
<argument type="service" id="sylius.factory.channel_price_history_config" />

View file

@ -11,29 +11,26 @@
declare(strict_types=1);
namespace Sylius\Bundle\ApiBundle\Serializer;
namespace Sylius\Bundle\ApiBundle\Serializer\Denormalizer;
use ApiPlatform\Api\IriConverterInterface;
use Sylius\Bundle\ApiBundle\Validator\ResourceInputDataPropertiesValidatorInterface;
use Sylius\Component\Core\Model\ChannelPriceHistoryConfigInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Webmozart\Assert\Assert;
final class ChannelPriceHistoryConfigDenormalizer implements ContextAwareDenormalizerInterface, DenormalizerAwareInterface
final class ChannelPriceHistoryConfigDenormalizer implements DenormalizerInterface, DenormalizerAwareInterface
{
use DenormalizerAwareTrait;
private const ALREADY_CALLED = 'sylius_channel_price_history_config_denormalizer_already_called';
public function __construct(
private IriConverterInterface $iriConverter,
private FactoryInterface $channelPriceHistoryConfigFactory,
private ResourceInputDataPropertiesValidatorInterface $validator,
private array $validationGroups = [],
private readonly IriConverterInterface $iriConverter,
private readonly FactoryInterface $channelPriceHistoryConfigFactory,
) {
}
@ -51,8 +48,6 @@ final class ChannelPriceHistoryConfigDenormalizer implements ContextAwareDenorma
$context[self::ALREADY_CALLED] = true;
$data = (array) $data;
$this->validateData($data);
$channelPriceHistoryConfig = $this->denormalizer->denormalize($data, $type, $format, $context);
Assert::isInstanceOf($channelPriceHistoryConfig, ChannelPriceHistoryConfigInterface::class);
$channelPriceHistoryConfig->clearTaxonsExcludedFromShowingLowestPrice();
@ -66,15 +61,4 @@ final class ChannelPriceHistoryConfigDenormalizer implements ContextAwareDenorma
return $channelPriceHistoryConfig;
}
private function validateData(array $data): void
{
/** @var ChannelPriceHistoryConfigInterface $dummyConfig */
$dummyConfig = $this->channelPriceHistoryConfigFactory->createNew();
$this->validator->validate(
$dummyConfig,
$data,
$this->validationGroups,
);
}
}

View file

@ -11,14 +11,12 @@
declare(strict_types=1);
namespace spec\Sylius\Bundle\ApiBundle\Serializer;
namespace spec\Sylius\Bundle\ApiBundle\Serializer\Denormalizer;
use ApiPlatform\Api\IriConverterInterface;
use ApiPlatform\Symfony\Validator\Exception\ValidationException;
use Doctrine\Common\Collections\ArrayCollection;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\ApiBundle\Validator\ResourceInputDataPropertiesValidatorInterface;
use Sylius\Component\Core\Model\ChannelPriceHistoryConfigInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
@ -31,9 +29,8 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
function let(
IriConverterInterface $iriConverter,
FactoryInterface $configFactory,
ResourceInputDataPropertiesValidatorInterface $validator,
): void {
$this->beConstructedWith($iriConverter, $configFactory, $validator, []);
$this->beConstructedWith($iriConverter, $configFactory);
}
function it_does_not_support_denormalization_when_the_denormalizer_has_already_been_called(): void
@ -54,40 +51,21 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
function it_throws_an_exception_when_denormalizing_an_object_that_is_not_a_channel_price_history_config(
DenormalizerInterface $denormalizer,
FactoryInterface $configFactory,
ResourceInputDataPropertiesValidatorInterface $validator,
ChannelPriceHistoryConfigInterface $dummyConfig,
): void {
$this->setDenormalizer($denormalizer);
$configFactory->createNew()->willReturn($dummyConfig);
$validator->validate($dummyConfig, [], [])->shouldBeCalled();
$denormalizer->denormalize([], 'string', null, [self::ALREADY_CALLED => true])->willReturn(new \stdClass());
$this->shouldThrow(\InvalidArgumentException::class)->during('denormalize', [[], 'string']);
}
function it_validates_input_data_before(
DenormalizerInterface $denormalizer,
FactoryInterface $configFactory,
ResourceInputDataPropertiesValidatorInterface $validator,
ChannelPriceHistoryConfigInterface $dummyConfig,
): void {
$this->setDenormalizer($denormalizer);
$configFactory->createNew()->willReturn($dummyConfig);
$validator->validate($dummyConfig, [], [])->willThrow(ValidationException::class);
$denormalizer->denormalize(Argument::cetera())->shouldNotBeCalled();
$this->shouldThrow(ValidationException::class)->during('denormalize', [[], 'string']);
}
function it_adds_excluded_taxons_from_data(
DenormalizerInterface $denormalizer,
IriConverterInterface $iriConverter,
FactoryInterface $configFactory,
ResourceInputDataPropertiesValidatorInterface $validator,
TaxonInterface $firstTaxon,
TaxonInterface $secondTaxon,
ChannelPriceHistoryConfigInterface $config,
@ -101,7 +79,6 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
]];
$configFactory->createNew()->willReturn($dummyConfig);
$validator->validate($dummyConfig, $data, [])->shouldBeCalled();
$denormalizer->denormalize($data, 'string', null, [self::ALREADY_CALLED => true])->willReturn($config);
@ -120,7 +97,6 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
DenormalizerInterface $denormalizer,
IriConverterInterface $iriConverter,
FactoryInterface $configFactory,
ResourceInputDataPropertiesValidatorInterface $validator,
TaxonInterface $firstTaxon,
TaxonInterface $secondTaxon,
ChannelPriceHistoryConfigInterface $config,
@ -131,7 +107,6 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
$data = [];
$configFactory->createNew()->willReturn($dummyConfig);
$validator->validate($dummyConfig, $data, [])->shouldBeCalled();
$denormalizer
->denormalize($data, 'string', null, [self::ALREADY_CALLED => true])
@ -156,7 +131,6 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
DenormalizerInterface $denormalizer,
IriConverterInterface $iriConverter,
FactoryInterface $configFactory,
ResourceInputDataPropertiesValidatorInterface $validator,
TaxonInterface $firstCurrentTaxon,
TaxonInterface $secondCurrentTaxon,
TaxonInterface $firstNewTaxon,
@ -172,7 +146,6 @@ final class ChannelPriceHistoryConfigDenormalizerSpec extends ObjectBehavior
]];
$configFactory->createNew()->willReturn($dummyConfig);
$validator->validate($dummyConfig, $data, [])->shouldBeCalled();
$denormalizer
->denormalize($data, 'string', null, [self::ALREADY_CALLED => true])

View file

@ -33,7 +33,7 @@ final class AdjustmentsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -30,7 +30,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
/** @test */
public function it_gets_catalog_promotions(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -70,7 +70,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -147,7 +147,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
/** @test */
public function it_does_not_create_a_catalog_promotion_with_taken_code(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -170,7 +170,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
/** @test */
public function it_does_not_create_a_catalog_promotion_with_end_date_earlier_than_start_date(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -197,7 +197,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -385,7 +385,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -641,7 +641,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',

View file

@ -30,7 +30,10 @@ final class ChannelsTest extends JsonApiTestCase
public function it_gets_a_channel(): void
{
$this->setUpDefaultGetHeaders();
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel/channel_with_taxons.yaml',
]);
/** @var ChannelInterface $channel */
$channel = $fixtures['channel_web'];
@ -44,7 +47,7 @@ final class ChannelsTest extends JsonApiTestCase
public function it_gets_channels(): void
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->requestGet('/api/v2/admin/channels');
@ -55,7 +58,10 @@ final class ChannelsTest extends JsonApiTestCase
public function it_creates_a_channel(): void
{
$this->setUpDefaultPostHeaders();
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'currency.yaml', 'locale.yaml']);
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'taxonomy.yaml',
]);
$this->requestPost('/api/v2/admin/channels', [
'name' => 'Web Store',
@ -84,7 +90,15 @@ final class ChannelsTest extends JsonApiTestCase
'city' => 'City: Created',
'postcode' => 'Postcode: Created',
],
'menuTaxon' => null,
'menuTaxon' => '/api/v2/admin/taxons/CATEGORY',
'channelPriceHistoryConfig' => [
'lowestPriceForDiscountedProductsVisible' => true,
'lowestPriceForDiscountedProductsCheckingPeriod' => 60,
'taxonsExcludedFromShowingLowestPrice' => [
'/api/v2/admin/taxons/BRAND',
'/api/v2/admin/taxons/HAT',
],
],
]);
$this->assertResponseCreated('admin/channel/post_channel_response');
@ -113,7 +127,11 @@ final class ChannelsTest extends JsonApiTestCase
/** @test */
public function it_updates_an_existing_channel(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel/channel.yaml',
'taxon_image.yaml',
]);
/** @var ChannelInterface $channel */
$channel = $fixtures['channel_web'];
@ -142,6 +160,14 @@ final class ChannelsTest extends JsonApiTestCase
'description' => 'different description',
'hostname' => 'updated-hostname.com',
'color' => 'blue',
'menuTaxon' => '/api/v2/admin/taxons/CATEGORY',
'channelPriceHistoryConfig' => [
'lowestPriceForDiscountedProductsVisible' => true,
'lowestPriceForDiscountedProductsCheckingPeriod' => 60,
'taxonsExcludedFromShowingLowestPrice' => [
'/api/v2/admin/taxons/MUG',
],
],
], \JSON_THROW_ON_ERROR),
);
@ -156,7 +182,7 @@ final class ChannelsTest extends JsonApiTestCase
public function it_deletes_a_channel(): void
{
$this->setUpDefaultDeleteHeaders();
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->requestGet('/api/v2/admin/channels/MOBILE');
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_OK);
@ -172,7 +198,7 @@ final class ChannelsTest extends JsonApiTestCase
public function it_prevents_deleting_the_only_channel(): void
{
$this->setUpDefaultDeleteHeaders();
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml']);
$this->requestDelete('/api/v2/admin/channels/MOBILE');
$this->requestDelete('/api/v2/admin/channels/WEB');

View file

@ -62,7 +62,7 @@ final class CurrenciesTest extends JsonApiTestCase
/** @test */
public function it_does_not_allow_creating_a_currency_with_invalid_code(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'authentication/api_administrator.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/api_administrator.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(

View file

@ -70,7 +70,7 @@ final class CustomersTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'customer.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/fulfilled.yaml',
]);
$header = $this->headerBuilder()->withJsonLdAccept()->withAdminUserAuthorization('api@example.com')->build();

View file

@ -27,7 +27,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'exchange_rate.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -53,7 +53,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'exchange_rate.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -76,7 +76,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'exchange_rate.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -104,7 +104,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'exchange_rate.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -136,7 +136,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'exchange_rate.yaml',
]);

View file

@ -86,7 +86,7 @@ final class LocalesTest extends JsonApiTestCase
/** @test */
public function it_does_not_allow_creating_a_locale_with_invalid_code(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'authentication/api_administrator.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/api_administrator.yaml']);
$header = $this->headerBuilder()->withJsonLdAccept()->withJsonLdContentType()->withAdminUserAuthorization('api@example.com')->build();
$this->client->request(

View file

@ -34,7 +34,7 @@ final class OrderItemUnitsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -52,7 +52,7 @@ final class OrderItemUnitsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -34,7 +34,7 @@ final class OrderItemsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -52,7 +52,7 @@ final class OrderItemsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/order_with_item.yaml',
'country.yaml',
'shipping_method.yaml',
@ -76,7 +76,7 @@ final class OrderItemsTest extends JsonApiTestCase
$this->setUpDatabase();
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/order_with_item.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -40,7 +40,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
@ -55,7 +55,7 @@ final class OrdersTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
@ -76,7 +76,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/customer.yaml',
'order/new.yaml',
'order/new_in_different_currencies.yaml',
@ -106,7 +106,7 @@ final class OrdersTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/customer.yaml',
'order/fulfilled.yaml',
]);
@ -136,7 +136,7 @@ final class OrdersTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'cart.yaml',
'channel.yaml',
'channel/channel.yaml',
'order/customer.yaml',
'payment_method.yaml',
'shipping_method.yaml',
@ -191,7 +191,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -212,7 +212,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -239,7 +239,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -267,7 +267,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -288,7 +288,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -309,7 +309,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -329,7 +329,7 @@ final class OrdersTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -27,7 +27,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'payment_method.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -53,7 +53,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'payment_method.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -72,7 +72,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -113,7 +113,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'payment_method.yaml',
]);
@ -166,7 +166,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'payment_method.yaml',
]);
@ -183,7 +183,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'payment_method.yaml',
]);

View file

@ -35,7 +35,7 @@ final class PaymentsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -56,7 +56,7 @@ final class PaymentsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -80,7 +80,7 @@ final class PaymentsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -104,7 +104,7 @@ final class PaymentsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -125,7 +125,7 @@ final class PaymentsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -34,7 +34,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product_option.yaml',
]);
@ -53,7 +53,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product_option.yaml',
]);
@ -69,7 +69,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
]);
$this->requestPost(
@ -105,7 +105,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
]);
$this->requestPost(
@ -147,7 +147,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product_option.yaml',
]);
@ -181,7 +181,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product_option.yaml',
]);
@ -211,7 +211,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product_option.yaml',
]);
@ -248,7 +248,7 @@ final class ProductOptionsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product_option.yaml',
]);

View file

@ -27,7 +27,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_gets_a_product_taxon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_taxon.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_taxon.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var ProductTaxonInterface $productTaxon */
@ -49,7 +49,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_gets_product_taxons(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_taxon.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_taxon.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(method: 'GET', uri: '/api/v2/admin/product-taxons', server: $header);
@ -64,7 +64,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_creates_a_product_taxon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_taxon.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_taxon.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var ProductInterface $product */
@ -93,7 +93,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_updates_a_product_taxon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_taxon.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_taxon.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var ProductTaxonInterface $productTaxon */
@ -118,7 +118,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_does_not_update_product_and_taxon_on_product_taxon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_taxon.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_taxon.yaml']);
/** @var ProductTaxonInterface $productTaxon */
$productTaxon = $fixtures['product_cap_taxon_caps'];
@ -147,7 +147,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_deletes_a_product_taxon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product_taxon.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product_taxon.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var ProductTaxonInterface $productTaxon */

View file

@ -28,7 +28,7 @@ final class ProductsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -52,7 +52,7 @@ final class ProductsTest extends JsonApiTestCase
/** @test */
public function it_gets_products(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -71,7 +71,7 @@ final class ProductsTest extends JsonApiTestCase
/** @test */
public function it_gets_products_with_image_filter(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'product/product.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'product/product.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -232,7 +232,7 @@ final class ProductsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product.yaml',
'product/product_attribute.yaml',
]);
@ -310,7 +310,7 @@ final class ProductsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -348,7 +348,7 @@ final class ProductsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
@ -370,7 +370,7 @@ final class ProductsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'product/product.yaml',
]);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);

View file

@ -26,7 +26,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_gets_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionCouponInterface $coupon */
@ -48,7 +48,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_gets_promotion_coupons(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(method: 'GET', uri: '/api/v2/admin/promotion-coupons', server: $header);
@ -63,7 +63,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_creates_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -93,7 +93,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_updates_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionCouponInterface $coupon */
@ -121,7 +121,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_generates_a_promotion_coupons(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -152,7 +152,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_does_not_generate_promotion_coupons_with_invalid_promotion_code(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -180,7 +180,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
/** @test */
public function it_removes_a_promotion_coupon(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionCouponInterface $coupon */
@ -200,7 +200,7 @@ final class PromotionCouponsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'promotion/promotion.yaml',
'promotion/promotion_order.yaml',
]);

View file

@ -38,7 +38,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_gets_promotions(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(method: 'GET', uri: '/api/v2/admin/promotions', server: $header);
@ -53,7 +53,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_gets_a_promotion(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -75,7 +75,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_gets_promotion_coupons(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -99,7 +99,7 @@ final class PromotionsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'customer_group.yaml',
'promotion/product.yaml',
@ -276,7 +276,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_does_not_create_a_promotion_with_taken_code(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -469,7 +469,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_updates_promotion(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -527,7 +527,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_updates_promotion_to_last_priority_when_priority_is_minus_one(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -552,7 +552,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_does_not_update_a_promotion_with_duplicate_locale_translation(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -579,7 +579,7 @@ final class PromotionsTest extends JsonApiTestCase
/** @test */
public function it_deletes_a_promotion(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'promotion/promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'promotion/promotion.yaml']);
$header = array_merge($this->logInAdminUser('api@example.com'), self::CONTENT_TYPE_HEADER);
/** @var PromotionInterface $promotion */
@ -599,7 +599,7 @@ final class PromotionsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'promotion/promotion.yaml',
'promotion/promotion_order.yaml',
]);
@ -622,7 +622,7 @@ final class PromotionsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'promotion/promotion.yaml',
]);
@ -647,7 +647,7 @@ final class PromotionsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'promotion/promotion.yaml',
]);

View file

@ -31,7 +31,7 @@ final class ShipmentsTest extends JsonApiTestCase
/** @test */
public function it_gets_shipments(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$anotherTokenValue = 'nAWw2jexpB';
@ -56,7 +56,7 @@ final class ShipmentsTest extends JsonApiTestCase
/** @test */
public function it_gets_shipment(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
@ -78,7 +78,7 @@ final class ShipmentsTest extends JsonApiTestCase
/** @test */
public function it_ships_shipment(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$order = $this->placeOrder('nAWw2jewpA');
@ -95,7 +95,7 @@ final class ShipmentsTest extends JsonApiTestCase
/** @test */
public function it_resends_shipment_confirmation_email(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$order = $this->placeOrder('nAWw2jewpA');
$order->getShipments()->last()->setState('shipped');
@ -114,7 +114,7 @@ final class ShipmentsTest extends JsonApiTestCase
/** @test */
public function it_does_not_resends_shipment_confirmation_email_for_shipment_with_invalid_state(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
@ -136,7 +136,7 @@ final class ShipmentsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -30,7 +30,7 @@ final class ShippingMethodTranslationsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);

View file

@ -32,7 +32,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -47,7 +47,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -65,7 +65,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'zones.yaml',
]);
@ -147,7 +147,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'zones.yaml',
]);
@ -201,7 +201,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'zones.yaml',
]);
@ -307,7 +307,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -370,7 +370,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -406,7 +406,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -459,7 +459,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -496,7 +496,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -584,7 +584,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -626,7 +626,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -646,7 +646,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);
@ -665,7 +665,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'channel/channel.yaml',
'country.yaml',
'shipping_method.yaml',
]);

View file

@ -10,6 +10,7 @@ Sylius\Component\Core\Model\Channel:
locales: ['@locale_en', '@locale_pl']
color: 'black'
enabled: true
menu_taxon: '@menu_taxon'
taxCalculationStrategy: 'order_items_based'
channelPriceHistoryConfig: '@web_price_history_config'
shopBillingData: '@channel_web_billing_data'
@ -35,11 +36,13 @@ Sylius\Component\Core\Model\ChannelPriceHistoryConfig:
mobile_price_history_config:
lowestPriceForDiscountedProductsCheckingPeriod: 25
lowestPriceForDiscountedProductsVisible: true
__calls:
- addTaxonExcludedFromShowingLowestPrice: ["@menu_taxon"]
Sylius\Component\Currency\Model\Currency:
currency_usd:
code: 'USD'
Sylius\Component\Core\Model\ShopBillingData:
channel_web_billing_data:
company: 'Web Channel Company'
@ -63,3 +66,7 @@ Sylius\Component\Locale\Model\Locale:
code: 'pl_PL'
locale_de:
code: 'de_DE'
Sylius\Component\Core\Model\Taxon:
menu_taxon:
code: "MENU"

View file

@ -0,0 +1,78 @@
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'
menuTaxon: '@category_taxon'
channelPriceHistoryConfig: '@web_price_history_config'
shopBillingData: '@channel_web_billing_data'
Sylius\Component\Core\Model\ChannelPriceHistoryConfig:
web_price_history_config:
lowestPriceForDiscountedProductsVisible: false
__calls:
- addTaxonExcludedFromShowingLowestPrice: ["@mug_taxon"]
- addTaxonExcludedFromShowingLowestPrice: ["@hat_taxon"]
Sylius\Component\Core\Model\ShopBillingData:
channel_web_billing_data:
company: 'Web Channel Company'
taxId: 'Web Channel Tax ID'
country_code: 'EN'
street: 'Web Channel Street'
city: 'Web Channel City'
postcode: 'Web Channel Postcode'
Sylius\Component\Currency\Model\Currency:
currency_usd:
code: 'USD'
Sylius\Component\Locale\Model\Locale:
locale_en:
code: 'en_US'
locale_pl:
code: 'pl_PL'
Sylius\Component\Core\Model\Taxon:
category_taxon:
code: "CATEGORY"
currentLocale: "en_US"
translations: ["@en_category_translation"]
children: ["@mug_taxon", "@hat_taxon"]
mug_taxon:
code: "MUG"
currentLocale: "en_US"
translations: ["@en_mug_taxon_translation"]
parent: "@category_taxon"
position: 0
hat_taxon:
code: "HAT"
currentLocale: "en_US"
translations: ["@en_hat_translation"]
parent: "@category_taxon"
position: 1
Sylius\Component\Taxonomy\Model\TaxonTranslation:
en_category_translation:
slug: "categories"
locale: "en_US"
name: "Categories"
translatable: "@category_taxon"
en_mug_taxon_translation:
slug: "categories/mugs"
locale: "en_US"
name: "Mugs"
translatable: "@mug_taxon"
en_hat_translation:
slug: "categories/hats"
locale: "en_US"
name: "Hats"
translatable: "@hat_taxon"

View file

@ -31,6 +31,11 @@
"city": "Web Channel City",
"postcode": "Web Channel Postcode"
},
"menuTaxon": null,
"channelPriceHistoryConfig": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@"
"menuTaxon": "/api/v2/admin/taxons/CATEGORY",
"channelPriceHistoryConfig": {
"@type": "ChannelPriceHistoryConfig",
"lowestPriceForDiscountedProductsVisible": false,
"lowestPriceForDiscountedProductsCheckingPeriod": 30,
"taxonsExcludedFromShowingLowestPrice": "@array@.count(2).inArray('/api/v2/admin/taxons/MUG').inArray('/api/v2/admin/taxons/HAT')"
}
}

View file

@ -35,8 +35,13 @@
"city": "Web Channel City",
"postcode": "Web Channel Postcode"
},
"menuTaxon": null,
"channelPriceHistoryConfig": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@"
"menuTaxon": "\/api\/v2\/admin\/taxons\/MENU",
"channelPriceHistoryConfig": {
"@type": "ChannelPriceHistoryConfig",
"lowestPriceForDiscountedProductsVisible": false,
"lowestPriceForDiscountedProductsCheckingPeriod": 30,
"taxonsExcludedFromShowingLowestPrice": []
}
},
{
"@id": "\/api\/v2\/admin\/channels\/MOBILE",
@ -71,7 +76,12 @@
"postcode": "Mobile Channel Postcode"
},
"menuTaxon": null,
"channelPriceHistoryConfig": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@"
"channelPriceHistoryConfig": {
"@type": "ChannelPriceHistoryConfig",
"lowestPriceForDiscountedProductsVisible": true,
"lowestPriceForDiscountedProductsCheckingPeriod": 25,
"taxonsExcludedFromShowingLowestPrice": "@array@.count(1).inArray('/api/v2/admin/taxons/MENU')"
}
}
],

View file

@ -33,6 +33,11 @@
"city": "City: Created",
"postcode": "Postcode: Created"
},
"menuTaxon": null,
"channelPriceHistoryConfig": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@"
"menuTaxon": "\/api\/v2\/admin\/taxons\/CATEGORY",
"channelPriceHistoryConfig": {
"@type": "ChannelPriceHistoryConfig",
"lowestPriceForDiscountedProductsVisible": true,
"lowestPriceForDiscountedProductsCheckingPeriod": 60,
"taxonsExcludedFromShowingLowestPrice": "@array@.count(2).inArray('/api/v2/admin/taxons/BRAND').inArray('/api/v2/admin/taxons/HAT')"
}
}

View file

@ -30,9 +30,14 @@
"city": "Web Channel City: Updated",
"postcode": "Web Channel Postcode: Updated"
},
"menuTaxon": null,
"menuTaxon": "\/api\/v2\/admin\/taxons\/CATEGORY",
"description": "different description",
"hostname": "updated-hostname.com",
"color": "blue",
"channelPriceHistoryConfig": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@"
"channelPriceHistoryConfig": {
"@type": "ChannelPriceHistoryConfig",
"lowestPriceForDiscountedProductsVisible": true,
"lowestPriceForDiscountedProductsCheckingPeriod": 60,
"taxonsExcludedFromShowingLowestPrice": "@array@.count(1).inArray('/api/v2/admin/taxons/MUG')"
}
}

View file

@ -1,12 +0,0 @@
{
"@context": "\/api\/v2\/contexts\/ChannelPriceHistoryConfig",
"@id": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@",
"@type": "ChannelPriceHistoryConfig",
"id": "@integer@",
"lowestPriceForDiscountedProductsVisible": false,
"lowestPriceForDiscountedProductsCheckingPeriod": 25,
"taxonsExcludedFromShowingLowestPrice": [
"\/api\/v2\/admin\/taxons\/MUG",
"\/api\/v2\/admin\/taxons\/HAT"
]
}

View file

@ -1,9 +0,0 @@
{
"@context": "\/api\/v2\/contexts\/ChannelPriceHistoryConfig",
"@id": "\/api\/v2\/admin\/channel-price-history-configs\/@integer@",
"@type": "ChannelPriceHistoryConfig",
"id": "@integer@",
"lowestPriceForDiscountedProductsVisible": true,
"lowestPriceForDiscountedProductsCheckingPeriod": 60,
"taxonsExcludedFromShowingLowestPrice": ["\/api\/v2\/admin\/taxons\/BRAND"]
}

View file

@ -32,7 +32,7 @@ final class AdjustmentsTest extends JsonApiTestCase
public function it_returns_not_found_on_get_adjustment(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -39,7 +39,7 @@ final class CatalogPromotionsTest extends JsonApiTestCase
private function loadFixturesAndGetCatalogPromotion(): CatalogPromotionInterface
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'catalog_promotion/catalog_promotion.yaml']);
/** @var CatalogPromotionInterface $catalogPromotion */
$catalogPromotion = $fixtures['catalog_promotion'];

View file

@ -21,7 +21,7 @@ final class ChannelsTest extends JsonApiTestCase
/** @test */
public function it_gets_collection_with_single_default_channel(): void
{
$this->loadFixturesFromFile('channel.yaml');
$this->loadFixturesFromFile('channel/channel.yaml');
$this->client->request(method: 'GET', uri: '/api/v2/shop/channels', server: self::CONTENT_TYPE_HEADER);
$response = $this->client->getResponse();
@ -41,7 +41,7 @@ final class ChannelsTest extends JsonApiTestCase
/** @test */
public function it_gets_channel_by_code(): void
{
$this->loadFixturesFromFile('channel.yaml');
$this->loadFixturesFromFile('channel/channel.yaml');
$this->client->request(method: 'GET', uri: '/api/v2/shop/channels/WEB', server: self::CONTENT_TYPE_HEADER);
$response = $this->client->getResponse();

View file

@ -31,7 +31,7 @@ final class CartTest extends JsonApiTestCase
/** @test */
public function it_creates_empty_cart(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$this->client->request(
method: 'POST',
@ -50,7 +50,7 @@ final class CartTest extends JsonApiTestCase
/** @test */
public function it_creates_empty_cart_with_provided_locale(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$this->client->request(
method: 'POST',
@ -71,7 +71,7 @@ final class CartTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'cart/existing_cart.yaml',
]);
@ -94,7 +94,7 @@ final class CartTest extends JsonApiTestCase
public function it_gets_empty_cart(): void
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$tokenValue = $this->pickUpCart();
@ -108,7 +108,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -127,7 +127,7 @@ final class CartTest extends JsonApiTestCase
public function it_adds_item_to_order(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -157,7 +157,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_to_add_item_to_order_with_missing_fields(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -185,7 +185,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -208,7 +208,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultDeleteHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -228,7 +228,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultDeleteHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -247,7 +247,7 @@ final class CartTest extends JsonApiTestCase
public function it_updates_item_quantity_in_cart(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -279,7 +279,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_to_update_item_quantity_in_cart_with_missing_fields(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -310,7 +310,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_to_update_item_quantity_if_invalid_id_item(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -333,7 +333,7 @@ final class CartTest extends JsonApiTestCase
public function it_updates_cart(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -381,7 +381,7 @@ final class CartTest extends JsonApiTestCase
/** @test */
public function it_does_not_allow_update_without_items(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml']);
$tokenValue = $this->pickUpCart();
@ -406,7 +406,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_update_without_required_billing_address(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
]);
@ -445,7 +445,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_update_without_required_shipping_address(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
]);
@ -484,7 +484,7 @@ final class CartTest extends JsonApiTestCase
public function it_does_not_allow_update_with_invalid_data(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
]);
@ -532,7 +532,7 @@ final class CartTest extends JsonApiTestCase
{
$this->setUpDefaultGetHeaders();
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -21,7 +21,7 @@ final class CountriesTest extends JsonApiTestCase
/** @test */
public function it_gets_countries(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'country.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'country.yaml']);
$this->client->request(method: 'GET', uri: '/api/v2/shop/countries', server: self::CONTENT_TYPE_HEADER);
$response = $this->client->getResponse();
@ -32,7 +32,7 @@ final class CountriesTest extends JsonApiTestCase
/** @test */
public function it_gets_only_countries_from_current_channel(): void
{
$this->loadFixturesFromFiles(['channel_with_countries.yaml', 'country.yaml']);
$this->loadFixturesFromFiles(['channel/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();

View file

@ -22,7 +22,7 @@ final class CurrenciesTest extends JsonApiTestCase
/** @test */
public function it_gets_a_currency(): void
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'currency.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'currency.yaml']);
/** @var CurrencyInterface $currency */
$currency = $fixtures['currency_usd'];
@ -43,7 +43,7 @@ final class CurrenciesTest extends JsonApiTestCase
/** @test */
public function it_gets_currencies(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'currency.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'currency.yaml']);
$this->client->request(method: 'GET', uri: '/api/v2/shop/currencies', server: self::CONTENT_TYPE_HEADER);

View file

@ -66,7 +66,7 @@ final class CustomersTest extends JsonApiTestCase
/** @test */
public function it_registers_a_new_customer(): void
{
$this->loadFixturesFromFiles(['channel.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml']);
$this->client->request(
method: 'POST',
@ -118,7 +118,7 @@ final class CustomersTest extends JsonApiTestCase
/** @test */
public function it_sends_reset_password_email(): void
{
$loadedData = $this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel.yaml']);
$loadedData = $this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel/channel.yaml']);
/** @var CustomerInterface $customer */
$customer = $loadedData['customer_oliver'];
@ -141,7 +141,7 @@ final class CustomersTest extends JsonApiTestCase
/** @test */
public function it_validates_wrong_reset_password_request(): void
{
$this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel/channel.yaml']);
$this->client->request(
method: 'POST',
@ -161,7 +161,7 @@ final class CustomersTest extends JsonApiTestCase
/** @test */
public function it_resets_account_password(): void
{
$loadedData = $this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel.yaml']);
$loadedData = $this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel/channel.yaml']);
/** @var ShopUserInterface $shopUser */
$shopUser = $loadedData['shop_user_oliver'];

View file

@ -22,7 +22,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
/** @test */
public function it_gets_exchange_rates(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'exchange_rate.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'exchange_rate.yaml']);
$this->client->request(method: 'GET', uri: '/api/v2/shop/exchange-rates', server: self::CONTENT_TYPE_HEADER);
$response = $this->client->getResponse();
@ -33,7 +33,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
/** @test */
public function it_gets_an_exchange_rate_with_source_currency_the_same_as_the_channel_base_currency(): void
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'exchange_rate.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'exchange_rate.yaml']);
/** @var ExchangeRateInterface $exchangeRate */
$exchangeRate = $fixtures['exchange_rate_USDPLN'];
@ -51,7 +51,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
/** @test */
public function it_gets_an_exchange_rate_with_target_currency_the_same_as_the_channel_base_currency(): void
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'exchange_rate.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'exchange_rate.yaml']);
/** @var ExchangeRateInterface $exchangeRate */
$exchangeRate = $fixtures['exchange_rate_CNYUSD'];
@ -69,7 +69,7 @@ final class ExchangeRatesTest extends JsonApiTestCase
/** @test */
public function it_cannot_get_an_exchange_rate_that_is_not_related_to_the_channel_base_currency()
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'exchange_rate.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'exchange_rate.yaml']);
/** @var ExchangeRateInterface $exchangeRate */
$exchangeRate = $fixtures['exchange_rate_GBPBTN'];

View file

@ -20,7 +20,7 @@ final class LocalesTest extends JsonApiTestCase
/** @test */
public function it_gets_locales(): void
{
$this->loadFixturesFromFiles(['channel_without_locales.yaml', 'locale.yaml']);
$this->loadFixturesFromFiles(['channel/channel_without_locales.yaml', 'locale.yaml']);
$this->requestGet(uri: '/api/v2/shop/locales', headers: self::CONTENT_TYPE_HEADER);
@ -30,7 +30,7 @@ final class LocalesTest extends JsonApiTestCase
/** @test */
public function it_gets_only_locales_from_current_channel(): void
{
$this->loadFixturesFromFiles(['locale.yaml', 'channel.yaml']);
$this->loadFixturesFromFiles(['locale.yaml', 'channel/channel.yaml']);
$this->requestGet(uri: '/api/v2/shop/locales', headers: self::CONTENT_TYPE_HEADER);
@ -40,7 +40,7 @@ final class LocalesTest extends JsonApiTestCase
/** @test */
public function it_gets_locale(): void
{
$this->loadFixturesFromFiles(['channel.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml']);
$this->requestGet(uri: '/api/v2/shop/locales/en_US', headers: self::CONTENT_TYPE_HEADER);

View file

@ -35,7 +35,7 @@ final class OrderItemUnitsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -59,7 +59,7 @@ final class OrderItemUnitsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -83,7 +83,7 @@ final class OrderItemUnitsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -35,7 +35,7 @@ final class OrderItemsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -58,7 +58,7 @@ final class OrderItemsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -82,7 +82,7 @@ final class OrderItemsTest extends JsonApiTestCase
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -105,7 +105,7 @@ final class OrderItemsTest extends JsonApiTestCase
public function it_gets_order_item_adjustments(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -124,7 +124,7 @@ final class OrderItemsTest extends JsonApiTestCase
public function it_gets_empty_order_item_adjustments_if_order_token_is_wrong(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -143,7 +143,7 @@ final class OrderItemsTest extends JsonApiTestCase
public function it_returns_nothing_if_a_user_tries_to_get_the_order_item_adjustments_of_another_user(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'authentication/shop_user.yaml',
@ -166,7 +166,7 @@ final class OrderItemsTest extends JsonApiTestCase
public function it_prevents_visitors_from_getting_the_item_adjustments_of_a_user_order(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'authentication/shop_user.yaml',

View file

@ -34,7 +34,7 @@ final class OrdersTest extends JsonApiTestCase
public function it_gets_order_adjustments(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -58,7 +58,7 @@ final class OrdersTest extends JsonApiTestCase
public function it_gets_order_adjustments_with_type_filter(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -24,7 +24,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_payment_methods_available_for_given_payment_and_order(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
@ -57,7 +57,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_all_enabled_payment_methods(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'payment_method.yaml']);
$this->client->request(
method: 'GET',
@ -72,7 +72,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_payment_method_by_code(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'payment_method.yaml']);
$this->client->request(
method: 'GET',
@ -87,7 +87,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_nothing_if_desired_payment_method_is_disabled(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'payment_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'payment_method.yaml']);
$this->client->request(
method: 'GET',

View file

@ -34,7 +34,7 @@ final class PaymentsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -21,7 +21,7 @@ final class ProductAttributesTest extends JsonApiTestCase
/** @test */
public function it_returns_product_attribute_with_translations_in_default_locale(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'product/product_attribute.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product_attribute.yaml']);
$this->client->request(
method: 'GET',
@ -39,7 +39,7 @@ final class ProductAttributesTest extends JsonApiTestCase
/** @test */
public function it_returns_product_attribute_with_translations_in_locale_from_header(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'product/product_attribute.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product_attribute.yaml']);
$this->client->request(
method: 'GET',

View file

@ -58,7 +58,7 @@ final class ProductReviewsTest extends JsonApiTestCase
public function it_creates_a_product_review(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -90,7 +90,7 @@ final class ProductReviewsTest extends JsonApiTestCase
public function it_prevents_from_creating_a_product_review_with_non_existing_product(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
]);
$this->client->request(
@ -113,7 +113,7 @@ final class ProductReviewsTest extends JsonApiTestCase
public function it_prevents_from_creating_a_product_review_without_email(): void
{
$fixtures = $this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',
@ -148,7 +148,7 @@ final class ProductReviewsTest extends JsonApiTestCase
public function it_prevents_from_creating_a_product_review_if_required_fields_are_missing(): void
{
$this->loadFixturesFromFiles([
'channel.yaml',
'channel/channel.yaml',
'tax_category.yaml',
'shipping_category.yaml',
'product/product_variant.yaml',

View file

@ -22,7 +22,7 @@ final class ProductTaxonsTest extends JsonApiTestCase
/** @test */
public function it_gets_a_product_taxon(): void
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'product/product_taxon.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product_taxon.yaml']);
/** @var ProductTaxonInterface $productTaxon */
$productTaxon = $fixtures['product_mug_taxon_mugs'];

View file

@ -122,7 +122,7 @@ final class ProductsTest extends JsonApiTestCase
/** @test */
public function it_returns_products_with_reviews(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'product/product.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product.yaml']);
$this->client->request(
method: 'GET',
@ -163,7 +163,7 @@ final class ProductsTest extends JsonApiTestCase
public function it_returns_product_attributes_collection_with_translations_in_locale_from_header(
string $polishLocale,
): void {
$this->loadFixturesFromFiles(['channel.yaml', 'product/product_attribute.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product_attribute.yaml']);
$this->client->request(
method: 'GET',
@ -180,7 +180,7 @@ final class ProductsTest extends JsonApiTestCase
/** @test */
public function it_returns_paginated_attributes_collection(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'product/product_attribute.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'product/product_attribute.yaml']);
$this->client->request(
method: 'GET',

View file

@ -25,7 +25,7 @@ final class SendContactRequestTest extends JsonApiTestCase
/** @test */
public function it_sends_contact_request(): void
{
$this->loadFixturesFromFiles(['channel.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml']);
$this->client->request(
method: 'POST',
@ -47,7 +47,7 @@ final class SendContactRequestTest extends JsonApiTestCase
/** @test */
public function it_sends_contact_request_as_logged_in_user(): void
{
$fixtures = $this->loadFixturesFromFiles(['channel.yaml', 'authentication/shop_user.yaml']);
$fixtures = $this->loadFixturesFromFiles(['channel/channel.yaml', 'authentication/shop_user.yaml']);
/** @var CustomerInterface $customer */
$customer = $fixtures['customer_oliver'];

View file

@ -34,7 +34,7 @@ final class ShipmentsTest extends JsonApiTestCase
/** @test */
public function it_gets_shipment(): void
{
$fixtures = $this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$fixtures = $this->loadFixturesFromFiles(['authentication/shop_user.yaml', 'channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
/** @var CustomerInterface $customer */
$customer = $fixtures['customer_oliver'];
$header = array_merge($this->logInShopUser($customer->getEmailCanonical()), self::CONTENT_TYPE_HEADER);

View file

@ -35,7 +35,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_all_available_shipping_methods_by_default_in_given_channel(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->requestGet('/api/v2/shop/shipping-methods');
@ -45,7 +45,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_a_shipping_method(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->requestGet('/api/v2/shop/shipping-methods/UPS');
@ -55,7 +55,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
/** @test */
public function it_does_not_get_a_shipping_method_not_available_in_given_channel(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->requestGet('/api/v2/shop/shipping-methods/FEDEX');
@ -65,7 +65,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
/** @test */
public function it_gets_shipping_methods_available_for_given_shipment_and_order(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$this->getCartAndPutItemForCustomer($tokenValue, 'sylius@example.com');
@ -87,7 +87,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -111,7 +111,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -139,7 +139,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
@ -155,7 +155,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
{
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel.yaml',
'channel/channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',

View file

@ -25,7 +25,7 @@ final class VerifyShopUsersTest extends JsonApiTestCase
/** @test */
public function it_resends_account_verification_token(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'authentication/shop_user.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'authentication/shop_user.yaml']);
$header = array_merge($this->logInShopUser('oliver@doe.com'), self::CONTENT_TYPE_HEADER);
$this->client->request(
@ -45,7 +45,7 @@ final class VerifyShopUsersTest extends JsonApiTestCase
/** @test */
public function it_does_not_allow_to_resend_token_for_not_logged_in_users(): void
{
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'authentication/shop_user.yaml']);
$this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'authentication/shop_user.yaml']);
$this->client->request(
method: 'POST',
@ -62,7 +62,7 @@ final class VerifyShopUsersTest extends JsonApiTestCase
/** @test */
public function it_verifies_customer_account(): void
{
$data = $this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml', 'authentication/shop_user.yaml']);
$data = $this->loadFixturesFromFiles(['channel/channel.yaml', 'cart.yaml', 'authentication/shop_user.yaml']);
/** @var ShopUserInterface $shopUser */
$shopUser = $data['shop_user_oliver'];