Skip to content

Commit 9982411

Browse files
committed
Added tests for the extension
1 parent 64cc4e5 commit 9982411

File tree

5 files changed

+11
-56
lines changed

5 files changed

+11
-56
lines changed

.gitignore

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,7 @@
1-
# Cache and logs (Symfony2)
2-
/app/cache/*
3-
/app/logs/*
4-
!app/cache/.gitkeep
5-
!app/logs/.gitkeep
6-
7-
# Cache and logs (Symfony3)
8-
/var/cache/*
9-
/var/logs/*
10-
!var/cache/.gitkeep
11-
!var/logs/.gitkeep
12-
13-
# Parameters
14-
/app/config/parameters.yml
15-
/app/config/parameters.ini
16-
17-
# Managed by Composer
18-
/app/bootstrap.php.cache
19-
/var/bootstrap.php.cache
20-
/bin/*
21-
!bin/console
22-
!bin/symfony_requirements
23-
/vendor/
24-
25-
# Assets and user uploads
26-
/web/bundles/
27-
/web/uploads/
28-
29-
# PHPUnit
30-
/app/phpunit.xml
31-
/phpunit.xml
1+
build
2+
phpunit.xml
3+
vendor
4+
composer.lock
5+
/composer.phar
326

33-
# Build data
34-
/build/
357

36-
# Composer PHAR
37-
/composer.phar

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"php-cache/doctrine-cache": "dev-master"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "^5.1|^4.0",
26+
"phpunit/phpunit": "5.0.*|^4.0",
2727
"matthiasnoback/symfony-dependency-injection-test": "0.7.*"
2828
},
2929
"autoload": {

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
*/
1414
class Configuration implements ConfigurationInterface
1515
{
16-
/**
17-
* @var bool
18-
*/
19-
private $debug;
20-
21-
/**
22-
* Constructor.
23-
*
24-
* @param Boolean $debug Whether to use the debug mode
25-
*/
26-
public function __construct($debug)
27-
{
28-
$this->debug = (Boolean) $debug;
29-
}
30-
3116
/**
3217
* Generates the configuration tree builder.
3318
*
@@ -55,11 +40,10 @@ private function getClustersNode()
5540

5641
$node
5742
->requiresAtLeastOneElement()
58-
->addDefaultChildrenIfNoneSet('default')
5943
->useAttributeAsKey('name')
6044
->prototype('array')
6145
->children()
62-
->enumNode('type')
46+
->enumNode('type')->isRequired()
6347
->values(array('redis', 'php_file', 'file_system', 'array', 'memcached', 'apc'))
6448
->end()
6549
->scalarNode('id')

src/DependencyInjection/DoctrineCacheExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DoctrineCacheExtension extends Extension
2222
*/
2323
public function load(array $configs, ContainerBuilder $container)
2424
{
25-
$configuration = new Configuration($container->getParameter('kernel.debug'));
25+
$configuration = new Configuration();
2626
$config = $this->processConfiguration($configuration, $configs);
2727

2828
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

tests/DependencyInjection/DoctrineCacheExtensionTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ protected function getContainerExtensions()
1515
);
1616
}
1717

18-
public function after_loading_the_correct_parameter_has_been_set()
18+
public function testThatProvidersExists()
1919
{
20-
$this->load();
20+
$providers = array('foo' => ['type'=>'apc']);
21+
$this->load(array('providers' => $providers));
2122

2223
$this->assertContainerBuilderHasParameter('doctrine_cache.providers');
2324
}

0 commit comments

Comments
 (0)