diff --git a/tests/Controller/SitemapProductControllerApiChannelDefaultLocaleTest.php b/tests/Controller/SitemapProductControllerApiChannelDefaultLocaleTest.php new file mode 100644 index 00000000..ebafc201 --- /dev/null +++ b/tests/Controller/SitemapProductControllerApiChannelDefaultLocaleTest.php @@ -0,0 +1,18 @@ +loadFixturesFromFiles(['channel_with_locale_different_from_default.yaml', 'product_with_locales.yaml']); + $this->generateSitemaps(); + + $response = $this->getBufferedResponse('/sitemap/products.xml'); + $this->assertResponse($response, 'show_sitemap_products_with_channel_default_locale'); + $this->deleteSitemaps(); + } +} diff --git a/tests/DataFixtures/ORM/channel_with_locale_different_from_default.yaml b/tests/DataFixtures/ORM/channel_with_locale_different_from_default.yaml new file mode 100644 index 00000000..20cf0b08 --- /dev/null +++ b/tests/DataFixtures/ORM/channel_with_locale_different_from_default.yaml @@ -0,0 +1,25 @@ +Sylius\Component\Core\Model\Channel: + web_channel: + code: "WEB" + name: "Web Store" + hostname: "localhost" + description: "Lorem ipsum" + baseCurrency: "@usd" + defaultLocale: "@locale_nl_nl" + locales: ["@locale_nl_nl"] + color: "black" + enabled: true + taxCalculationStrategy: "order_items_based" + accountVerificationRequired: true + +Sylius\Component\Currency\Model\Currency: + usd: + code: USD + euro: + code: EUR + +Sylius\Component\Locale\Model\Locale: + locale_nl_nl: + code: nl_NL + locale_en_us: + code: en_US diff --git a/tests/DataFixtures/ORM/product_with_locales.yaml b/tests/DataFixtures/ORM/product_with_locales.yaml new file mode 100644 index 00000000..e62cc3d4 --- /dev/null +++ b/tests/DataFixtures/ORM/product_with_locales.yaml @@ -0,0 +1,20 @@ +Sylius\Component\Core\Model\Product: + test_product: + code: "test-code" + channels: ["@web_channel"] + currentLocale: "nl_NL" + translations: + - "@nl_nl_test_product_translation" + - "@en_us_test_product_translation" + +Sylius\Component\Core\Model\ProductTranslation: + nl_nl_test_product_translation: + slug: "test-code" + locale: "nl_NL" + name: "Test" + translatable: "@test_product" + en_us_test_product_translation: + slug: "test-code" + locale: "en_US" + name: "Test" + translatable: "@test_product" diff --git a/tests/Responses/show_sitemap_products_with_channel_default_locale.xml b/tests/Responses/show_sitemap_products_with_channel_default_locale.xml new file mode 100644 index 00000000..d1ef212a --- /dev/null +++ b/tests/Responses/show_sitemap_products_with_channel_default_locale.xml @@ -0,0 +1,9 @@ + + + + http://localhost/nl_NL/products/test-code + @string@.isDateTime() + always + 0.5 + +