Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -56,8 +56,6 @@ class CheckDefinitionValidityPassTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyProcessDetectsBothFactorySyntaxesUsed()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('a')->setFactory(array('a', 'b'))->setFactoryClass('a');
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ class LegacyResolveParameterPlaceHoldersPassTest extends \PHPUnit_Framework_Test
|
|||
{
|
||||
public function testFactoryClassParametersShouldBeResolved()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$compilerPass = new ResolveParameterPlaceHoldersPass();
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
|
|
|
@ -117,6 +117,25 @@ class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(array(), $def->getTags());
|
||||
}
|
||||
|
||||
public function testProcessDoesNotCopyDecoratedService()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container
|
||||
->register('parent')
|
||||
->setDecoratedService('foo')
|
||||
;
|
||||
|
||||
$container
|
||||
->setDefinition('child', new DefinitionDecorator('parent'))
|
||||
;
|
||||
|
||||
$this->process($container);
|
||||
|
||||
$def = $container->getDefinition('child');
|
||||
$this->assertNull($def->getDecoratedService());
|
||||
}
|
||||
|
||||
public function testProcessHandlesMultipleInheritance()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
@ -173,6 +192,21 @@ class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue($container->getDefinition('child1')->isLazy());
|
||||
}
|
||||
|
||||
public function testSetDecoratedServiceOnServiceHasParent()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->register('parent', 'stdClass');
|
||||
|
||||
$container->setDefinition('child1', new DefinitionDecorator('parent'))
|
||||
->setDecoratedService('foo', 'foo_inner')
|
||||
;
|
||||
|
||||
$this->process($container);
|
||||
|
||||
$this->assertEquals(array('foo', 'foo_inner'), $container->getDefinition('child1')->getDecoratedService());
|
||||
}
|
||||
|
||||
protected function process(ContainerBuilder $container)
|
||||
{
|
||||
$pass = new ResolveDefinitionTemplatesPass();
|
||||
|
|
|
@ -342,8 +342,6 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testLegacyCreateServiceFactory()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('bar', 'Bar\FooClass');
|
||||
$builder
|
||||
|
@ -363,8 +361,6 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyCreateServiceFactoryService()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('foo_service', 'Bar\FooClass');
|
||||
$builder
|
||||
|
@ -405,9 +401,12 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
$builder->register('foo3', 'Bar\FooClass')->setConfigurator(array(new Reference('baz'), 'configure'));
|
||||
$this->assertTrue($builder->get('foo3')->configured, '->createService() calls the configurator');
|
||||
|
||||
$builder->register('foo4', 'Bar\FooClass')->setConfigurator('foo');
|
||||
$builder->register('foo4', 'Bar\FooClass')->setConfigurator(array($builder->getDefinition('baz'), 'configure'));
|
||||
$this->assertTrue($builder->get('foo4')->configured, '->createService() calls the configurator');
|
||||
|
||||
$builder->register('foo5', 'Bar\FooClass')->setConfigurator('foo');
|
||||
try {
|
||||
$builder->get('foo4');
|
||||
$builder->get('foo5');
|
||||
$this->fail('->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertEquals('The configure callable for class "Bar\FooClass" is not a callable.', $e->getMessage(), '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
|
||||
|
@ -732,8 +731,6 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacySetOnSynchronizedService()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('baz', 'BazClass')
|
||||
->setSynchronized(true)
|
||||
|
@ -754,8 +751,6 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacySynchronizedServiceWithScopes()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->addScope(new Scope('foo'));
|
||||
$container->register('baz', 'BazClass')
|
||||
|
|
|
@ -55,8 +55,6 @@ class DefinitionDecoratorTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacySetProperty($property, $changeKey)
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$def = new DefinitionDecorator('foo');
|
||||
|
||||
$getter = 'get'.ucfirst($property);
|
||||
|
|
|
@ -170,8 +170,6 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacySetIsSynchronized()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$def = new Definition('stdClass');
|
||||
$this->assertFalse($def->isSynchronized(), '->isSynchronized() returns false by default');
|
||||
$this->assertSame($def, $def->setSynchronized(true), '->setSynchronized() implements a fluent interface');
|
||||
|
|
|
@ -28,8 +28,6 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyDump()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = include self::$fixturesPath.'/containers/legacy-container9.php';
|
||||
$dumper = new GraphvizDumper($container);
|
||||
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/legacy-services9.dot')), $dumper->dump(), '->dump() dumps services');
|
||||
|
|
|
@ -129,8 +129,6 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacySynchronizedServices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = include self::$fixturesPath.'/containers/container20.php';
|
||||
$dumper = new PhpDumper($container);
|
||||
$this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services20.php')), $dumper->dump(), '->dump() dumps services');
|
||||
|
|
|
@ -49,8 +49,6 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAddService()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = include self::$fixturesPath.'/containers/legacy-container9.php';
|
||||
$dumper = new XmlDumper($container);
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyAddService()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = include self::$fixturesPath.'/containers/legacy-container9.php';
|
||||
$dumper = new YamlDumper($container);
|
||||
|
||||
|
|
|
@ -44,4 +44,4 @@ $phar->addFromString('schema/project-1.0.xsd', <<<EOT
|
|||
</xsd:schema>
|
||||
EOT
|
||||
);
|
||||
$phar->setStub('<?php require_once "phar://ProjectWithXsdExtensionInPhar.phar/ProjectWithXsdExtensionInPhar.php"; __HALT_COMPILER(); ?>');
|
||||
$phar->setStub('<?php Phar::mapPhar("ProjectWithXsdExtensionInPhar.phar"); require_once "phar://ProjectWithXsdExtensionInPhar.phar/ProjectWithXsdExtensionInPhar.php"; __HALT_COMPILER(); ?>');
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
<services>
|
||||
<service id="constructor" class="FooClass" factory-method="getInstance" />
|
||||
<service id="factory_service" factory-method="getInstance" factory-service="baz_factory" />
|
||||
<service id="request" class="Request" synthetic="true" synchronized="true" lazy="true"/>
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
</service>
|
||||
<service id="alias_for_foo" alias="foo" />
|
||||
<service id="another_alias_for_foo" alias="foo" public="false" />
|
||||
<service id="request" class="Request" synthetic="true" synchronized="true" lazy="true"/>
|
||||
<service id="decorator_service" decorates="decorated" />
|
||||
<service id="decorator_service_with_name" decorates="decorated" decoration-inner-name="decorated.pif-pouf"/>
|
||||
<service id="new_factory1" class="FooBarClass">
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
services:
|
||||
constructor: { class: FooClass, factory_method: getInstance }
|
||||
factory_service: { class: BazClass, factory_method: getInstance, factory_service: baz_factory }
|
||||
request:
|
||||
class: Request
|
||||
synthetic: true
|
||||
synchronized: true
|
||||
lazy: true
|
||||
|
|
|
@ -23,11 +23,6 @@ services:
|
|||
another_alias_for_foo:
|
||||
alias: foo
|
||||
public: false
|
||||
request:
|
||||
class: Request
|
||||
synthetic: true
|
||||
synchronized: true
|
||||
lazy: true
|
||||
decorator_service:
|
||||
decorates: decorated
|
||||
decorator_service_with_name:
|
||||
|
|
|
@ -19,11 +19,6 @@ use Symfony\Component\DependencyInjection\Reference;
|
|||
*/
|
||||
class LegacyContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService
|
||||
*/
|
||||
|
|
|
@ -18,11 +18,6 @@ use Symfony\Component\DependencyInjection\Definition;
|
|||
*/
|
||||
class LegacyDefinitionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testSetGetFactoryClass()
|
||||
{
|
||||
$def = new Definition('stdClass');
|
||||
|
|
|
@ -195,8 +195,6 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyLoadServices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
|
||||
$loader->load('legacy-services6.xml');
|
||||
|
@ -206,6 +204,10 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertNull($services['factory_service']->getClass());
|
||||
$this->assertEquals('baz_factory', $services['factory_service']->getFactoryService());
|
||||
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod());
|
||||
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
|
||||
$this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag');
|
||||
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
|
||||
$this->assertNull($services['request']->getDecoratedService());
|
||||
}
|
||||
|
||||
public function testLoadServices()
|
||||
|
@ -231,10 +233,6 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag');
|
||||
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
|
||||
|
||||
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
|
||||
$this->assertTrue($services['request']->isSynchronized(false), '->load() parses the synchronized flag');
|
||||
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
|
||||
|
||||
$aliases = $container->getAliases();
|
||||
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses <service> elements');
|
||||
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
|
||||
|
@ -243,7 +241,6 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
|
||||
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
|
||||
|
||||
$this->assertNull($services['request']->getDecoratedService());
|
||||
$this->assertEquals(array('decorated', null), $services['decorator_service']->getDecoratedService());
|
||||
$this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->getDecoratedService());
|
||||
}
|
||||
|
|
|
@ -124,8 +124,6 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLegacyLoadServices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
|
||||
$loader->load('legacy-services6.yml');
|
||||
|
@ -135,6 +133,10 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('BazClass', $services['factory_service']->getClass());
|
||||
$this->assertEquals('baz_factory', $services['factory_service']->getFactoryService());
|
||||
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod());
|
||||
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
|
||||
$this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag');
|
||||
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
|
||||
$this->assertNull($services['request']->getDecoratedService());
|
||||
}
|
||||
|
||||
public function testLoadServices()
|
||||
|
@ -160,10 +162,6 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(array(new Reference('baz'), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag');
|
||||
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
|
||||
|
||||
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
|
||||
$this->assertTrue($services['request']->isSynchronized(false), '->load() parses the synchronized flag');
|
||||
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
|
||||
|
||||
$aliases = $container->getAliases();
|
||||
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases');
|
||||
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
|
||||
|
@ -172,7 +170,6 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
|
||||
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
|
||||
|
||||
$this->assertNull($services['request']->getDecoratedService());
|
||||
$this->assertEquals(array('decorated', null), $services['decorator_service']->getDecoratedService());
|
||||
$this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->getDecoratedService());
|
||||
}
|
||||
|
|
Reference in a new issue