Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix base locale" #10341

Merged
merged 1 commit into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "Fix base locale"
  • Loading branch information
pamil authored Apr 29, 2019
commit d6444c5d6e68edc893005a9660f2440576d13e4a
19 changes: 3 additions & 16 deletions src/Sylius/Bundle/CoreBundle/Fixture/LocaleFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public function __construct(FactoryInterface $localeFactory, ObjectManager $loca
*/
public function load(array $options): void
{
foreach ($options['locales'] as $localeCode) {
$localesCodes = array_merge([$this->baseLocaleCode], $options['locales']);

foreach ($localesCodes as $localeCode) {
/** @var LocaleInterface $locale */
$locale = $this->localeFactory->createNew();

Expand All @@ -71,21 +73,6 @@ public function getName(): string
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void
{
$optionsNode
->beforeNormalization()
->ifEmpty()
->then(function(){
@trigger_error(
'Base locale deprecated since 1.3. Please, pass %locale% directly to locales fixture at fixtures option.',
E_USER_DEPRECATED
);

return [
'locales'=>[
$this->baseLocaleCode
]
];
})
->end()
->children()
->arrayNode('locales')
->scalarPrototype()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ sylius_fixtures:
logger: ~

fixtures:
locale:
options:
locales:
- "%locale%"

locale: ~
currency:
options:
currencies: ['USD']
Expand Down
26 changes: 1 addition & 25 deletions src/Sylius/Bundle/CoreBundle/Tests/Fixture/LocaleFixtureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,7 @@ public function locales_are_not_required(): void
*/
public function locales_can_be_set(): void
{
$this->assertConfigurationIsValid([['locales' => ['en_US', 'pl_PL', 'es_ES']]], 'locales');
}

/**
* @test
*/
public function default_locale_is_added_by_default(): void
{
$this->assertProcessedConfigurationEquals(
[[]],
['locales' => ['default_LOCALE']],
'locales'
);
}

/**
* @test
*/
public function default_locale_is_not_added_if_locales_passed_directly(): void
{
$this->assertProcessedConfigurationEquals(
[['locales' => ['en_US']]],
['locales' => ['en_US']],
'locales'
);
$this->assertConfigurationIsValid([['locales' => ['en_US' => true, 'pl_PL' => false, 'es_ES' => true]]], 'locales');
}

/**
Expand Down