ExtensionTest.php in Service Container 7
File
modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php
View source
<?php
namespace Symfony\Component\DependencyInjection\Tests\Extension;
class ExtensionTest extends \PHPUnit_Framework_TestCase {
public function testIsConfigEnabledReturnsTheResolvedValue($enabled) {
$pb = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag')
->setMethods(array(
'resolveValue',
))
->getMock();
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')
->setMethods(array(
'getParameterBag',
))
->getMock();
$pb
->expects($this
->once())
->method('resolveValue')
->with($this
->equalTo($enabled))
->will($this
->returnValue($enabled));
$container
->expects($this
->once())
->method('getParameterBag')
->will($this
->returnValue($pb));
$extension = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\Extension')
->setMethods(array())
->getMockForAbstractClass();
$r = new \ReflectionMethod('Symfony\\Component\\DependencyInjection\\Extension\\Extension', 'isConfigEnabled');
$r
->setAccessible(true);
$r
->invoke($extension, $container, array(
'enabled' => $enabled,
));
}
public function getResolvedEnabledFixtures() {
return array(
array(
true,
),
array(
false,
),
);
}
public function testIsConfigEnabledOnNonEnableableConfig() {
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')
->getMock();
$extension = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\Extension')
->setMethods(array())
->getMockForAbstractClass();
$r = new \ReflectionMethod('Symfony\\Component\\DependencyInjection\\Extension\\Extension', 'isConfigEnabled');
$r
->setAccessible(true);
$r
->invoke($extension, $container, array());
}
}