Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View file

@ -125,6 +125,14 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
if (isset($changes['lazy'])) {
$def->setLazy($definition->isLazy());
}
if (isset($changes['decorated_service'])) {
$decoratedService = $definition->getDecoratedService();
if (null === $decoratedService) {
$def->setDecoratedService($decoratedService);
} else {
$def->setDecoratedService($decoratedService[0], $decoratedService[1]);
}
}
// merge arguments
foreach ($definition->getArguments() as $k => $v) {

View file

@ -47,7 +47,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
foreach ($definition->getMethodCalls() as $call) {
try {
$calls[] = array($call[0], $this->processArguments($call[1], true));
} catch (RuntimeException $ignore) {
} catch (RuntimeException $e) {
// this call is simply removed
}
}
@ -58,7 +58,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
try {
$value = $this->processArguments(array($value), true);
$properties[$name] = reset($value);
} catch (RuntimeException $ignore) {
} catch (RuntimeException $e) {
// ignore property
}
}

View file

@ -38,7 +38,7 @@ class ResolveParameterPlaceHoldersPass implements CompilerPassInterface
$definition->setFile($parameterBag->resolveValue($definition->getFile()));
$definition->setArguments($parameterBag->resolveValue($definition->getArguments()));
if ($definition->getFactoryClass(false)) {
$definition->setFactoryClass($parameterBag->resolveValue($definition->getFactoryClass()));
$definition->setFactoryClass($parameterBag->resolveValue($definition->getFactoryClass(false)));
}
$factory = $definition->getFactory();

View file

@ -982,7 +982,13 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if ($callable = $definition->getConfigurator()) {
if (is_array($callable)) {
$callable[0] = $callable[0] instanceof Reference ? $this->get((string) $callable[0]) : $parameterBag->resolveValue($callable[0]);
$callable[0] = $parameterBag->resolveValue($callable[0]);
if ($callable[0] instanceof Reference) {
$callable[0] = $this->get((string) $callable[0], $callable[0]->getInvalidBehavior());
} elseif ($callable[0] instanceof Definition) {
$callable[0] = $this->createService($callable[0], null);
}
}
if (!is_callable($callable)) {
@ -1127,7 +1133,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
private function synchronize($id)
{
if ('request' !== $id) {
trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
}
foreach ($this->definitions as $definitionId => $definition) {

View file

@ -98,7 +98,7 @@ class Definition
*/
public function setFactoryClass($factoryClass)
{
trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryClass), E_USER_DEPRECATED);
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryClass), E_USER_DEPRECATED);
$this->factoryClass = $factoryClass;
@ -116,7 +116,7 @@ class Definition
public function getFactoryClass($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->factoryClass;
@ -134,7 +134,7 @@ class Definition
*/
public function setFactoryMethod($factoryMethod)
{
trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryMethod), E_USER_DEPRECATED);
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryMethod), E_USER_DEPRECATED);
$this->factoryMethod = $factoryMethod;
@ -187,7 +187,7 @@ class Definition
public function getFactoryMethod($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->factoryMethod;
@ -205,7 +205,7 @@ class Definition
*/
public function setFactoryService($factoryService)
{
trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
$this->factoryService = $factoryService;
@ -223,7 +223,7 @@ class Definition
public function getFactoryService($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->factoryService;
@ -667,7 +667,7 @@ class Definition
public function setSynchronized($boolean, $triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
}
$this->synchronized = (bool) $boolean;
@ -687,7 +687,7 @@ class Definition
public function isSynchronized($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->synchronized;

View file

@ -170,6 +170,16 @@ class DefinitionDecorator extends Definition
return parent::setLazy($boolean);
}
/**
* {@inheritdoc}
*/
public function setDecoratedService($id, $renamedId = null)
{
$this->changes['decorated_service'] = true;
return parent::setDecoratedService($id, $renamedId);
}
/**
* Gets an argument to pass to the service constructor/factory method.
*

View file

@ -278,7 +278,7 @@ class GraphvizDumper extends Dumper
*/
private function dotize($id)
{
return strtolower(preg_replace('/[^\w]/i', '_', $id));
return strtolower(preg_replace('/\W/i', '_', $id));
}
/**

View file

@ -705,7 +705,7 @@ EOF;
}
if ('request' !== $id) {
trigger_error('Synchronized services were deprecated in version 2.7 and won\'t work anymore in 3.0.', E_USER_DEPRECATED);
@trigger_error('Synchronized services were deprecated in version 2.7 and won\'t work anymore in 3.0.', E_USER_DEPRECATED);
}
$code = '';
@ -862,8 +862,8 @@ EOF;
if (count($scopes = $this->container->getScopes()) > 0) {
$code .= "\n";
$code .= " \$this->scopes = ".$this->dumpValue($scopes).";\n";
$code .= " \$this->scopeChildren = ".$this->dumpValue($this->container->getScopeChildren()).";\n";
$code .= ' $this->scopes = '.$this->dumpValue($scopes).";\n";
$code .= ' $this->scopeChildren = '.$this->dumpValue($this->container->getScopeChildren()).";\n";
}
$code .= $this->addMethodMap();
@ -908,8 +908,8 @@ EOF;
$code .= "\n";
if (count($scopes = $this->container->getScopes()) > 0) {
$code .= " \$this->scopes = ".$this->dumpValue($scopes).";\n";
$code .= " \$this->scopeChildren = ".$this->dumpValue($this->container->getScopeChildren()).";\n";
$code .= ' $this->scopes = '.$this->dumpValue($scopes).";\n";
$code .= ' $this->scopeChildren = '.$this->dumpValue($this->container->getScopeChildren()).";\n";
} else {
$code .= " \$this->scopes = array();\n";
$code .= " \$this->scopeChildren = array();\n";
@ -1301,11 +1301,6 @@ EOF;
foreach ($value->getArguments() as $argument) {
$arguments[] = $this->dumpValue($argument);
}
$class = $this->dumpValue($value->getClass());
if (false !== strpos($class, '$')) {
throw new RuntimeException('Cannot dump definitions which have a variable class name.');
}
if (null !== $value->getFactory()) {
$factory = $value->getFactory();
@ -1343,6 +1338,15 @@ EOF;
}
}
$class = $value->getClass();
if (null === $class) {
throw new RuntimeException('Cannot dump definitions which have no class nor factory.');
}
$class = $this->dumpValue($class);
if (false !== strpos($class, '$')) {
throw new RuntimeException('Cannot dump definitions which have a variable class name.');
}
return sprintf('new \\%s(%s)', substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
} elseif ($value instanceof Variable) {
return '$'.$value;
@ -1414,7 +1418,7 @@ EOF;
*/
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6.2 and will be removed in 3.0. Use the Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6.2 and will be removed in 3.0. Use the Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider method instead.', E_USER_DEPRECATED);
$this->expressionLanguageProviders[] = $provider;
}

View file

@ -126,10 +126,11 @@ class XmlFileLoader extends FileLoader
* Parses an individual Definition.
*
* @param \DOMElement $service
* @param string $file
*
* @return Definition|null
*/
private function parseDefinition(\DOMElement $service)
private function parseDefinition(\DOMElement $service, $file)
{
if ($alias = $service->getAttribute('alias')) {
$public = true;
@ -149,13 +150,22 @@ class XmlFileLoader extends FileLoader
foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) {
if ($value = $service->getAttribute($key)) {
if (in_array($key, array('factory-class', 'factory-method', 'factory-service'))) {
@trigger_error(sprintf('The "%s" attribute of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use the "factory" element instead.', $key, (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
}
$method = 'set'.str_replace('-', '', $key);
$definition->$method(XmlUtils::phpize($value));
}
}
if ($value = $service->getAttribute('synchronized')) {
$definition->setSynchronized(XmlUtils::phpize($value), 'request' !== (string) $service->getAttribute('id'));
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
if ($triggerDeprecation) {
@trigger_error(sprintf('The "synchronized" attribute of service "%s" in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
}
$definition->setSynchronized(XmlUtils::phpize($value), $triggerDeprecation);
}
if ($files = $this->getChildren($service, 'file')) {
@ -173,7 +183,7 @@ class XmlFileLoader extends FileLoader
$factoryService = $this->getChildren($factory, 'service');
if (isset($factoryService[0])) {
$class = $this->parseDefinition($factoryService[0]);
$class = $this->parseDefinition($factoryService[0], $file);
} elseif ($childService = $factory->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
} else {
@ -192,7 +202,7 @@ class XmlFileLoader extends FileLoader
$configuratorService = $this->getChildren($configurator, 'service');
if (isset($configuratorService[0])) {
$class = $this->parseDefinition($configuratorService[0]);
$class = $this->parseDefinition($configuratorService[0], $file);
} elseif ($childService = $configurator->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
} else {
@ -233,7 +243,7 @@ class XmlFileLoader extends FileLoader
}
/**
* Parses a XML file to a \DOMDocument
* Parses a XML file to a \DOMDocument.
*
* @param string $file Path to a file
*
@ -392,7 +402,7 @@ class XmlFileLoader extends FileLoader
}
/**
* Get child elements by name
* Get child elements by name.
*
* @param \DOMNode $node
* @param mixed $name

View file

@ -172,6 +172,7 @@ class YamlFileLoader extends FileLoader
}
if (isset($service['synchronized'])) {
@trigger_error(sprintf('The "synchronized" key of service "%s" in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', $id, $file), E_USER_DEPRECATED);
$definition->setSynchronized($service['synchronized'], 'request' !== $id);
}
@ -201,14 +202,17 @@ class YamlFileLoader extends FileLoader
}
if (isset($service['factory_class'])) {
@trigger_error(sprintf('The "factory_class" key of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $id, $file), E_USER_DEPRECATED);
$definition->setFactoryClass($service['factory_class']);
}
if (isset($service['factory_method'])) {
@trigger_error(sprintf('The "factory_method" key of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $id, $file), E_USER_DEPRECATED);
$definition->setFactoryMethod($service['factory_method']);
}
if (isset($service['factory_service'])) {
@trigger_error(sprintf('The "factory_service" key of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $id, $file), E_USER_DEPRECATED);
$definition->setFactoryService($service['factory_service']);
}

View file

@ -69,4 +69,14 @@ class FrozenParameterBag extends ParameterBag
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}
/**
* {@inheritdoc}
*
* @api
*/
public function remove($name)
{
throw new LogicException('Impossible to call remove() on a frozen ParameterBag.');
}
}

View file

@ -11,7 +11,7 @@
namespace Symfony\Component\DependencyInjection;
trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\ExpressionLanguage\Expression;

View file

@ -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');

View file

@ -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();

View file

@ -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();

View file

@ -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')

View file

@ -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);

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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);

View file

@ -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);

View file

@ -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(); ?>');

View file

@ -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>

View file

@ -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">

View file

@ -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

View file

@ -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:

View file

@ -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
*/

View file

@ -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');

View file

@ -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());
}

View file

@ -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());
}