Yaffs site version 1.1
[yaffs-website] / vendor / symfony / dependency-injection / Tests / LegacyDefinitionTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\DependencyInjection\Tests;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\Definition;
16
17 /**
18  * @group legacy
19  */
20 class LegacyDefinitionTest extends TestCase
21 {
22     public function testSetGetFactoryClass()
23     {
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.');
28     }
29
30     public function testSetGetFactoryMethod()
31     {
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');
36     }
37
38     public function testSetGetFactoryService()
39     {
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.');
44     }
45 }