4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Tests;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\Definition;
20 class LegacyDefinitionTest extends TestCase
22 public function testSetGetFactoryClass()
24 $def = new Definition('stdClass');
25 $this->assertNull($def->getFactoryClass());
26 $this->assertSame($def, $def->setFactoryClass('stdClass2'), '->setFactoryClass() implements a fluent interface.');
27 $this->assertEquals('stdClass2', $def->getFactoryClass(), '->getFactoryClass() returns current class to construct this service.');
30 public function testSetGetFactoryMethod()
32 $def = new Definition('stdClass');
33 $this->assertNull($def->getFactoryMethod());
34 $this->assertSame($def, $def->setFactoryMethod('foo'), '->setFactoryMethod() implements a fluent interface');
35 $this->assertEquals('foo', $def->getFactoryMethod(), '->getFactoryMethod() returns the factory method name');
38 public function testSetGetFactoryService()
40 $def = new Definition('stdClass');
41 $this->assertNull($def->getFactoryService());
42 $this->assertSame($def, $def->setFactoryService('foo.bar'), '->setFactoryService() implements a fluent interface.');
43 $this->assertEquals('foo.bar', $def->getFactoryService(), '->getFactoryService() returns current service to construct this service.');