|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of php-cache organization. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Cache\AdapterBundle\Tests\Unit\DependencyInjection; |
|
13
|
|
|
|
|
14
|
|
|
use Cache\AdapterBundle\DependencyInjection\CacheAdapterExtension; |
|
15
|
|
|
use Cache\AdapterBundle\DummyAdapter; |
|
16
|
|
|
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; |
|
17
|
|
|
|
|
18
|
|
|
class DoctrineCacheExtensionTest extends AbstractExtensionTestCase |
|
19
|
|
|
{ |
|
20
|
|
|
protected function getContainerExtensions() |
|
21
|
|
|
{ |
|
22
|
|
|
return [ |
|
23
|
|
|
new CacheAdapterExtension(), |
|
24
|
|
|
]; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function testThatProvidersExists() |
|
28
|
|
|
{ |
|
29
|
|
|
$providers = ['foo' => ['factory' => 'cache.factory.array']]; |
|
30
|
|
|
$this->load(['providers' => $providers]); |
|
31
|
|
|
|
|
32
|
|
|
$this->assertContainerBuilderHasService('cache.provider.foo', DummyAdapter::class); |
|
33
|
|
|
$this->assertContainerBuilderHasAlias('cache', 'cache.provider.foo'); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testAliasProvidersExists() |
|
37
|
|
|
{ |
|
38
|
|
|
$providers = ['foo' => ['factory' => 'cache.factory.array', 'aliases' => ['alias_http']]]; |
|
39
|
|
|
$this->load(['providers' => $providers]); |
|
40
|
|
|
|
|
41
|
|
|
$this->assertContainerBuilderHasService('cache.provider.foo', DummyAdapter::class); |
|
42
|
|
|
$this->assertContainerBuilderHasAlias('cache', 'cache.provider.foo'); |
|
43
|
|
|
$this->assertContainerBuilderHasAlias('alias_http', 'cache.provider.foo'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function testDefaultAliasProvidersExists() |
|
47
|
|
|
{ |
|
48
|
|
|
$providers = [ |
|
49
|
|
|
'foo' => ['factory' => 'cache.factory.array', 'aliases' => ['alias_foo']], |
|
50
|
|
|
'bar' => ['factory' => 'cache.factory.array', 'aliases' => ['alias_bar', 'alias_other']], |
|
51
|
|
|
]; |
|
52
|
|
|
$this->load(['providers' => $providers]); |
|
53
|
|
|
|
|
54
|
|
|
$this->assertContainerBuilderHasService('cache.provider.foo', DummyAdapter::class); |
|
55
|
|
|
$this->assertContainerBuilderHasAlias('cache', 'cache.provider.foo'); |
|
56
|
|
|
$this->assertContainerBuilderHasAlias('alias_foo', 'cache.provider.foo'); |
|
57
|
|
|
$this->assertContainerBuilderHasAlias('alias_bar', 'cache.provider.bar'); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|