Skip to content

Commit 29f7298

Browse files
committed
FIX ignored options in converters configuration
1 parent b04e644 commit 29f7298

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.1.1] - 2020-10-24
10+
### Fixed
11+
- the converter `options` configuration key is not ignored anymore
12+
913
## [1.1.0] - 2020-10-23
1014
### Added
1115
- **Twig** `commonmark` filter
@@ -14,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1418
### Added
1519
- Bundle base
1620

17-
[Unreleased]: https://github.com/AymDev/CommonMarkBundle/compare/v1.1.0...HEAD
21+
[Unreleased]: https://github.com/AymDev/CommonMarkBundle/compare/v1.1.1...HEAD
22+
[1.1.1]: https://github.com/AymDev/CommonMarkBundle/compare/v1.1.0...v1.1.1
1823
[1.1.0]: https://github.com/AymDev/CommonMarkBundle/compare/v1.0.0...v1.1.0
1924
[1.0.0]: https://github.com/AymDev/CommonMarkBundle/releases/tag/v1.0.0
2025

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getConfigTreeBuilder()
2121
->values(['commonmark', 'github'])
2222
->defaultValue('commonmark')
2323
->end()
24-
->arrayNode('options')->ignoreExtraKeys()->end()
24+
->variableNode('options')->end()
2525
->arrayNode('extensions')->scalarPrototype()->end()
2626
->end()
2727
->end()

tests/DependencyInjection/ConfigurationTest.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Tests\AymDev\CommonMarkBundle\DependencyInjection;
44

5-
use Aymdev\CommonmarkBundle\DependencyInjection\AymdevCommonMarkExtension;
5+
use Aymdev\CommonmarkBundle\DependencyInjection\AymdevCommonmarkExtension;
66
use Aymdev\CommonmarkBundle\DependencyInjection\Compiler\ConvertersPass;
77
use PHPUnit\Framework\TestCase;
88
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -17,7 +17,7 @@ class ConfigurationTest extends TestCase
1717
public function testConfigurationFormat($config)
1818
{
1919
$container = new ContainerBuilder();
20-
$extension = new AymdevCommonMarkExtension();
20+
$extension = new AymdevCommonmarkExtension();
2121

2222
self::assertNull($extension->load($config, $container));
2323
$converters = $container->getParameter(ConvertersPass::PARAMETER_CONVERTERS);
@@ -44,4 +44,19 @@ public function provideConfiguration(): \Generator
4444
yield [Yaml::parse(file_get_contents($file))];
4545
}
4646
}
47+
48+
public function testConverterOptionsAreWellParsed()
49+
{
50+
$file = __DIR__ . '/../Fixtures/config/configuration_options.yaml';
51+
$config = Yaml::parse(file_get_contents($file));
52+
53+
$container = new ContainerBuilder();
54+
$extension = new AymdevCommonmarkExtension();
55+
56+
$extension->load($config, $container);
57+
$converter = $container->getParameter(ConvertersPass::PARAMETER_CONVERTERS);
58+
59+
$expectedOptions = $config['aymdev_commonmark']['converters']['my_converter']['options'];
60+
self::assertSame($expectedOptions, $converter['my_converter']['options']);
61+
}
4762
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
aymdev_commonmark:
2+
converters:
3+
my_converter:
4+
type: commonmark
5+
options:
6+
renderer:
7+
soft_break: "\n"
8+
use_underscore: false
9+
extensions:
10+
- League\CommonMark\Extension\Autolink\AutolinkExtension

0 commit comments

Comments
 (0)