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\Core23ShariffExtension; |
15
|
|
|
use Core23\ShariffBundle\Service\AddThis; |
16
|
|
|
use Core23\ShariffBundle\Service\Buffer; |
17
|
|
|
use Core23\ShariffBundle\Service\Facebook; |
18
|
|
|
use Core23\ShariffBundle\Service\Pinterest; |
19
|
|
|
use Core23\ShariffBundle\Service\Reddit; |
20
|
|
|
use Core23\ShariffBundle\Service\StumbleUpon; |
21
|
|
|
use Core23\ShariffBundle\Service\Vk; |
22
|
|
|
use Core23\ShariffBundle\Service\Xing; |
23
|
|
|
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; |
24
|
|
|
|
25
|
|
|
final class Core23ShariffExtensionTest extends AbstractExtensionTestCase |
26
|
|
|
{ |
27
|
|
|
public function testLoadDefault(): void |
28
|
|
|
{ |
29
|
|
|
$this->load([ |
30
|
|
|
'cache' => 'my.cache', |
31
|
|
|
'http_client' => 'my.http_client', |
32
|
|
|
'request_factory' => 'my.request_factory', |
33
|
|
|
]); |
34
|
|
|
|
35
|
|
|
$this->assertContainerBuilderHasParameter('core23_shariff.services', [ |
36
|
|
|
'addthis', 'buffer', 'pinterest', 'reddit', 'stumbleupon', 'vk', 'xing', |
37
|
|
|
]); |
38
|
|
|
|
39
|
|
|
$this->assertContainerBuilderNotHasService(Facebook::class); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testVerifyServices(): void |
43
|
|
|
{ |
44
|
|
|
$this->load([ |
45
|
|
|
'cache' => 'my.cache', |
46
|
|
|
'http_client' => 'my.http_client', |
47
|
|
|
'request_factory' => 'my.request_factory', |
48
|
|
|
]); |
49
|
|
|
|
50
|
|
|
$this->assertContainerBuilderHasService(AddThis::class); |
51
|
|
|
$this->assertContainerBuilderHasService(Buffer::class); |
52
|
|
|
$this->assertContainerBuilderHasService(Pinterest::class); |
53
|
|
|
$this->assertContainerBuilderHasService(Reddit::class); |
54
|
|
|
$this->assertContainerBuilderHasService(StumbleUpon::class); |
55
|
|
|
$this->assertContainerBuilderHasService(Vk::class); |
56
|
|
|
$this->assertContainerBuilderHasService(Xing::class); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testLoadFacebook(): void |
60
|
|
|
{ |
61
|
|
|
$this->load([ |
62
|
|
|
'cache' => 'my.cache', |
63
|
|
|
'http_client' => 'my.http_client', |
64
|
|
|
'request_factory' => 'my.request_factory', |
65
|
|
|
'services' => [ |
66
|
|
|
'facebook' => [ |
67
|
|
|
'app_id' => 'foo_id', |
68
|
|
|
'secret' => 'app_secret', |
69
|
|
|
'version' => '1.0', |
70
|
|
|
], |
71
|
|
|
], |
72
|
|
|
]); |
73
|
|
|
|
74
|
|
|
$this->assertContainerBuilderHasParameter('core23_shariff.services', [ |
75
|
|
|
'addthis', 'buffer', 'facebook', 'pinterest', 'reddit', 'stumbleupon', 'vk', 'xing', |
76
|
|
|
]); |
77
|
|
|
|
78
|
|
|
$this->assertContainerBuilderHasParameter('core23_shariff.service.facebook.app_id', 'foo_id'); |
79
|
|
|
$this->assertContainerBuilderHasParameter('core23_shariff.service.facebook.secret', 'app_secret'); |
80
|
|
|
$this->assertContainerBuilderHasParameter('core23_shariff.service.facebook.version', '1.0'); |
81
|
|
|
|
82
|
|
|
$this->assertContainerBuilderHasService(Facebook::class); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
protected function getContainerExtensions(): array |
86
|
|
|
{ |
87
|
|
|
return [ |
88
|
|
|
new Core23ShariffExtension(), |
89
|
|
|
]; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|