|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +namespace Neusta\Pimcore\TestingFramework\Tests\Functional; |
| 5 | + |
| 6 | +use Neusta\Pimcore\TestingFramework\Test\Attribute\ConfigureExtension; |
| 7 | +use Neusta\Pimcore\TestingFramework\Test\Attribute\RegisterBundle; |
| 8 | +use Neusta\Pimcore\TestingFramework\Test\ConfigurableKernelTestCase; |
| 9 | +use Neusta\Pimcore\TestingFramework\Tests\Fixtures\ConfigurationBundle\ConfigurationBundle; |
| 10 | + |
| 11 | +final class DataProviderTest extends ConfigurableKernelTestCase |
| 12 | +{ |
| 13 | + public function provideData(): iterable |
| 14 | + { |
| 15 | + yield 'kernel configuration at the beginning' => [ |
| 16 | + new RegisterBundle(ConfigurationBundle::class), |
| 17 | + new ConfigureExtension('configuration', [ |
| 18 | + 'foo' => 'value1', |
| 19 | + 'bar' => ['value2', 'value3'], |
| 20 | + ]), |
| 21 | + 'value1', |
| 22 | + 'value2', |
| 23 | + 'value3', |
| 24 | + ]; |
| 25 | + |
| 26 | + yield 'kernel configuration at the end' => [ |
| 27 | + 'foo', |
| 28 | + 'bar', |
| 29 | + 'baz', |
| 30 | + new RegisterBundle(ConfigurationBundle::class), |
| 31 | + new ConfigureExtension('configuration', [ |
| 32 | + 'foo' => 'foo', |
| 33 | + 'bar' => ['bar', 'baz'], |
| 34 | + ]), |
| 35 | + ]; |
| 36 | + |
| 37 | + yield 'kernel configuration in between other provided data' => [ |
| 38 | + 'test1', |
| 39 | + new RegisterBundle(ConfigurationBundle::class), |
| 40 | + 'test2', |
| 41 | + new ConfigureExtension('configuration', [ |
| 42 | + 'foo' => 'test1', |
| 43 | + 'bar' => ['test2', 'test3'], |
| 44 | + ]), |
| 45 | + 'test3', |
| 46 | + ]; |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * @test |
| 51 | + * |
| 52 | + * @dataProvider provideData |
| 53 | + */ |
| 54 | + public function configuration_via_data_provider(string $value1, string $value2, string $value3): void |
| 55 | + { |
| 56 | + $container = self::getContainer(); |
| 57 | + |
| 58 | + self::assertSame($value1, $container->getParameter('configuration.foo')); |
| 59 | + self::assertSame([$value2, $value3], $container->getParameter('configuration.bar')); |
| 60 | + } |
| 61 | +} |
0 commit comments