Toxic effect of mi
The present invent
Fingerprint identi
The objective of t
Novel approaches t
New York (CNN Busi
In vitro susceptib
Ask HN: How do
The present invent
Q:
How to read necontainer = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
->disableOriginalConstructor()
->getMock();
$this->containerConfig = <<<'JSON'
{
"%security.load_providers%": [
{% for provider in form_providers %}
"Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Security\\{{ provider }}"{% if not loop.last %} , {% endif %}{% endfor %}
],
"%security.property_access.load_property%": [
{% for property in form_properties %}
"Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Security\\{{ property }}"{% if not loop.last %} , {% endif %}{% endfor %}
],
}
JSON;
$pass = new PassConfig(array(), array(), $this->containerConfig);
$this->pass = new DoctrineLazyArrayLoaderPass($this->container, $pass);
}
public function testProcess()
{
$this->container->expects($this->once())
->method('get')
->with('security.providers')
->will($this->returnValue(array('provider1', 'provider2', 'provider3')));
$this->container->expects($this->once())
->method('get')
->with('security.property_access.load_property')
->will($this->returnValue(array('property1', 'property2', 'property3')));
$doctrineLazyArrayLoaderPass = new DoctrineLazyArrayLoaderPass($this->container);
$this->assertSame('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineLazyArrayLoaderPass', get_class($doctrineLazyArrayLoaderPass));
$this->assertSame($this->containerConfig, $doctrineLazyArrayLoaderPass->getContainerConfig());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyServices());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyConfigs());
$this->assertSame(array('provider1', 'provider2', 'provider3'), $doctrineLazyArrayLoaderPass->getServicesToLazyLoad());
$this->assertSame(array('property1', 'property2', 'property3'), $doctrineLazyArrayLoaderPass->getConfigsToLazyLoad());
$doctrineLazyArrayLoaderPass = new DoctrineLazyArrayLoaderPass($this->container);
$this->assertSame($this->containerConfig, $doctrineLazyArrayLoaderPass->getContainerConfig());
$this->assertSame(array('provider1', 'provider2', 'provider3'), $doctrineLazyArrayLoaderPass->getLazyServices());
$this->assertSame(array('property1', 'property2', 'property3'), $doctrineLazyArrayLoaderPass->getLazyConfigs());
$pass = new DoctrineLazyArrayLoaderPass($this->container, $pass);
$this->assertSame($this->containerConfig, $pass->getContainerConfig());
$this->assertSame(array('provider1', 'provider2', 'provider3'), $pass->getLazyServices());
$this->assertSame(array('property1', 'property2', 'property3'), $pass->getLazyConfigs());
}
public function testProcessWithInvalidArray()
{
$this->container->expects($this->once())
->method('get')
->with('security.providers')
->will($this->returnValue(array('provider1')));
$this->container->expects($this->once())
->method('get')
->with('security.property_access.load_property')
->will($this->returnValue(array('property1')));
$doctrineLazyArrayLoaderPass = new DoctrineLazyArrayLoaderPass($this->container);
$this->pass = new DoctrineLazyArrayLoaderPass($this->container, $this->containerConfig);
$this->assertSame('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineLazyArrayLoaderPass', get_class($doctrineLazyArrayLoaderPass));
$this->assertSame($this->containerConfig, $doctrineLazyArrayLoaderPass->getContainerConfig());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyServices());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyConfigs());
$doctrineLazyArrayLoaderPass = new DoctrineLazyArrayLoaderPass($this->container);
$this->pass = new DoctrineLazyArrayLoaderPass($this->container, $this->containerConfig);
$this->assertSame($this->containerConfig, $doctrineLazyArrayLoaderPass->getContainerConfig());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyServices());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyConfigs());
}
public function testProcessDoctrineLazyLoaderException()
{
$this->container->expects($this->once())
->method('get')
->with('security.providers')
->will($this->returnValue(array('provider1', 'provider2', 'provider3')));
$this->container->expects($this->once())
->method('get')
->with('security.property_access.load_property')
->will($this->returnValue(array('property1', 'property2', 'property3')));
$doctrineLazyArrayLoaderPass = new DoctrineLazyArrayLoaderPass($this->container);
$this->assertSame(new InvalidArgumentException('[ERROR] The following services are lazy: Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Security\\DoctrineLazyLoader. "Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Security\\DoctrineLazyLoader" is not an existing service. Maybe you forgot to add a service that has the same "id" attribute ?'), $doctrineLazyArrayLoaderPass);
$this->assertSame($this->containerConfig, $doctrineLazyArrayLoaderPass->getContainerConfig());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyServices());
$this->assertSame(array(), $doctrineLazyArrayLoaderPass->getLazyConfigs());
}
public function testProcessServices()
{
$this->container->expects($this->once())
->method('has')
->with($this->identicalTo('security.providers'))
->will($this->returnValue(true));
$this->container->expects($this->once())
->method('get')
->with('security.providers')
->will($this->returnValue(array('provider1', 'provider2', 'provider3')));
$this->container->expects($this->once())
->method('has')
->with($this->identicalTo('security.property_access.load_property'))
->will($this->returnValue(true));
$this->container->expects($this->once())
->method('get')
->with('security.property_access.load_property')
->will($this->returnValue(array('property1', 'property2', 'property3')));
$doctrineLazyArrayLoaderPass = new DoctrineLazyArrayLoaderPass