1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* (c) Christian Gripp <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Core23\ShariffBundle\Tests\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Core23\ShariffBundle\DependencyInjection\Configuration; |
15
|
|
|
use PHPUnit\Framework\TestCase; |
16
|
|
|
use Symfony\Component\Config\Definition\Processor; |
17
|
|
|
|
18
|
|
|
final class ConfigurationTest extends TestCase |
19
|
|
|
{ |
20
|
|
|
public function testDefaultOptions(): void |
21
|
|
|
{ |
22
|
|
|
$processor = new Processor(); |
23
|
|
|
|
24
|
|
|
$config = $processor->processConfiguration(new Configuration(), [[ |
25
|
|
|
'cache' => 'my.cache', |
26
|
|
|
'http_client' => 'my.http_client', |
27
|
|
|
'request_factory' => 'my.request_factory', |
28
|
|
|
]]); |
29
|
|
|
|
30
|
|
|
$expected = [ |
31
|
|
|
'cache' => 'my.cache', |
32
|
|
|
'http_client' => 'my.http_client', |
33
|
|
|
'request_factory' => 'my.request_factory', |
34
|
|
|
'options' => [ |
35
|
|
|
'domains' => [], |
36
|
|
|
'services' => ['addthis', 'buffer', 'facebook', 'pinterest', 'reddit', 'stumbleupon', 'vk', 'xing'], |
37
|
|
|
], |
38
|
|
|
]; |
39
|
|
|
|
40
|
|
|
static::assertSame($expected, $config); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testOptions(): void |
44
|
|
|
{ |
45
|
|
|
$processor = new Processor(); |
46
|
|
|
|
47
|
|
|
$config = $processor->processConfiguration(new Configuration(), [[ |
48
|
|
|
'cache' => 'my.cache', |
49
|
|
|
'http_client' => 'my.http_client', |
50
|
|
|
'request_factory' => 'my.request_factory', |
51
|
|
|
'options' => [ |
52
|
|
|
'domain' => 'http://foo.bar', |
53
|
|
|
'service' => 'GooglePlus', |
54
|
|
|
], |
55
|
|
|
]]); |
56
|
|
|
|
57
|
|
|
$expected = [ |
58
|
|
|
'cache' => 'my.cache', |
59
|
|
|
'http_client' => 'my.http_client', |
60
|
|
|
'request_factory' => 'my.request_factory', |
61
|
|
|
'options' => [ |
62
|
|
|
'domains' => ['http://foo.bar'], |
63
|
|
|
'services' => ['GooglePlus'], |
64
|
|
|
], |
65
|
|
|
]; |
66
|
|
|
|
67
|
|
|
static::assertSame($expected, $config); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|