-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Test that it will use the channel default locale to generate si…
…temap
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
tests/Controller/SitemapProductControllerApiChannelDefaultLocaleTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\SitemapPlugin\Controller; | ||
|
||
final class SitemapProductControllerApiChannelDefaultLocaleTest extends XmlApiTestCase | ||
{ | ||
public function testShowActionResponse(): void | ||
{ | ||
$this->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(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/DataFixtures/ORM/channel_with_locale_different_from_default.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
9 changes: 9 additions & 0 deletions
9
tests/Responses/show_sitemap_products_with_channel_default_locale.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml"> | ||
<url> | ||
<loc>http://localhost/nl_NL/products/test-code</loc> | ||
<lastmod>@[email protected]()</lastmod> | ||
<changefreq>always</changefreq> | ||
<priority>0.5</priority> | ||
</url> | ||
</urlset> |