mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 17:40:58 +00:00
[Core] Add order token length to configuration
This commit is contained in:
parent
2b58e016d4
commit
a711e468c8
3 changed files with 41 additions and 0 deletions
|
|
@ -54,6 +54,10 @@ final class Configuration implements ConfigurationInterface
|
|||
->setDeprecated('sylius/sylius', '1.10', 'The "%path%.%node%" parameter is deprecated and will be removed in 2.0.')
|
||||
->defaultFalse()
|
||||
->end()
|
||||
->integerNode('order_token_length')
|
||||
->defaultValue(64)
|
||||
->min(1)->max(255)
|
||||
->end()
|
||||
->arrayNode('catalog_promotions')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ final class SyliusCoreExtension extends AbstractResourceExtension implements Pre
|
|||
|
||||
$container->setParameter('sylius_core.taxation.shipping_address_based_taxation', $config['shipping_address_based_taxation']);
|
||||
$container->setParameter('sylius_core.order_by_identifier', $config['order_by_identifier']);
|
||||
$container->setParameter('sylius_core.order_token_length', $config['order_token_length']);
|
||||
$container->setParameter('sylius_core.catalog_promotions.batch_size', $config['catalog_promotions']['batch_size']);
|
||||
|
||||
/** @var string $env */
|
||||
|
|
|
|||
|
|
@ -72,6 +72,42 @@ final class ConfigurationTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_has_a_set_default_order_token_length(): void
|
||||
{
|
||||
$this->assertProcessedConfigurationEquals(
|
||||
[[]],
|
||||
['order_token_length' => 64],
|
||||
'order_token_length',
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_allows_changing_the_order_token_length(): void
|
||||
{
|
||||
$this->assertProcessedConfigurationEquals(
|
||||
[['order_token_length' => 128]],
|
||||
['order_token_length' => 128],
|
||||
'order_token_length',
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_throws_exception_when_order_token_length_is_invalid(): void
|
||||
{
|
||||
$this->assertConfigurationIsInvalid([['order_token_length' => 'string']]);
|
||||
$this->assertConfigurationIsInvalid(
|
||||
[['order_token_length' => 0]],
|
||||
'/Should be greater than or equal to 1$/',
|
||||
true,
|
||||
);
|
||||
$this->assertConfigurationIsInvalid(
|
||||
[['order_token_length' => 256]],
|
||||
'/Should be less than or equal to 255$/',
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_throws_an_exception_if_value_other_then_integer_is_declared_as_batch_size(): void
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue