-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConfigurationTest.php
More file actions
41 lines (32 loc) · 1.44 KB
/
ConfigurationTest.php
File metadata and controls
41 lines (32 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Webfactory\ShortcodeBundle\Tests\DependencyInjection;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Processor;
use Webfactory\ShortcodeBundle\DependencyInjection\Configuration;
class ConfigurationTest extends TestCase
{
#[Test]
public function configure_shortcode_with_controller_reference_only(): void
{
$processedConfig = $this->processSingleConfig(['shortcodes' => ['test-1' => 'Foo::bar']]);
self::assertTrue(isset($processedConfig['shortcodes']['test-1']['controller']));
self::assertSame('Foo::bar', $processedConfig['shortcodes']['test-1']['controller']);
}
#[Test]
public function configure_shortcode_with_controller_as_key(): void
{
$processedConfig = $this->processSingleConfig(['shortcodes' => ['test-1' => ['controller' => 'Foo::bar']]]);
self::assertSame('Foo::bar', $processedConfig['shortcodes']['test-1']['controller']);
}
#[Test]
public function configure_shortcode_with_method(): void
{
$processedConfig = $this->processSingleConfig(['shortcodes' => ['test-1' => ['controller' => 'Foo::bar', 'method' => 'esi']]]);
self::assertSame('esi', $processedConfig['shortcodes']['test-1']['method']);
}
private function processSingleConfig(array $config): array
{
return (new Processor())->processConfiguration(new Configuration(), [$config]);
}
}