Skip to content

Commit

Permalink
[WIP] Test that it will use the channel default locale to generate si…
Browse files Browse the repository at this point in the history
…temap
  • Loading branch information
lruozzi9 committed Jan 2, 2023
1 parent 3e76b67 commit 1a181d3
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
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();
}
}
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
20 changes: 20 additions & 0 deletions tests/DataFixtures/ORM/product_with_locales.yaml
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"
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>

0 comments on commit 1a181d3

Please sign in to comment.