* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\ExtensionCompilerPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; /** * @author Wouter J */ class ExtensionCompilerPassTest extends TestCase { private $container; private $pass; protected function setUp() { $this->container = new ContainerBuilder(); $this->pass = new ExtensionCompilerPass(); } public function testProcess() { $extension1 = new CompilerPassExtension('extension1'); $extension2 = new DummyExtension('extension2'); $extension3 = new DummyExtension('extension3'); $extension4 = new CompilerPassExtension('extension4'); $this->container->registerExtension($extension1); $this->container->registerExtension($extension2); $this->container->registerExtension($extension3); $this->container->registerExtension($extension4); $this->pass->process($this->container); $this->assertTrue($this->container->hasDefinition('extension1')); $this->assertFalse($this->container->hasDefinition('extension2')); $this->assertFalse($this->container->hasDefinition('extension3')); $this->assertTrue($this->container->hasDefinition('extension4')); } } class DummyExtension extends Extension { private $alias; public function __construct($alias) { $this->alias = $alias; } public function getAlias() { return $this->alias; } public function load(array $configs, ContainerBuilder $container) { } public function process(ContainerBuilder $container) { $container->register($this->alias); } } class CompilerPassExtension extends DummyExtension implements CompilerPassInterface { } __halt_compiler();----SIGNATURE:----O388QwB1wU0OEowGV6ZTSU3XDbkQnmMxOMf/wsMLzvGc2CK7KLN2PyTDua/swCUiy1X7VbVp2Ivb9WVxnLoU0/CLqnt/wdn8MOpx5Gr7Q9mb6gsSBi8U2bpb6E3Q36N2lKX+y8LuxE+HE6VDCWglnxwpZSYWW7XJ2kqrt01VSZC+TRmi93gQwMKTNlS0XOB7ZHECMHq1bkeVeR54xDcK/lGTJ0Y6fmili+MA0+AYiTcVsv57TZEgKvezw7iyieHRfJXlMvfJaTz1IFYZrzklPuUUAaypNhus7A2Y2dCiwYLq6GhXsguWe+znIwmTtMl1pJv9+uWwVmwMshHegVSFQUmfvFIilWqM0ApOkAdRJM9KAmxFNYlBsGaIZfc7W/7p/KUT/iPi+2sbuXQ64bdMQxzES8zp+nm6d0X1Dv1Y9GECHTOcFaLZnuzBQ6ezfmuhvCb5dnu8xZd6HMiIV3nHEThu1YCcds3grYJT8dYkYmcrB36ma19nRssX78AVN1IzxZlf2TQ0fSDPVJLPUWv3+CJfjmDG/9gSfZwPwE0khJwLIqz8ovieiAc/45jwNESvWK0oKJJVnBaTTDg9QgqxnGgSUKovPTOBkXD4T1t3vu9ilmntlh0DL0wzqz5W2YgMe+enIJ/gjmzXTkfTB0rGAHs2od6ezHQFmWz/xSCYcog=----ATTACHMENT:----Njk2NzY3NzY1MTgwNDAxOCA3NTkwNTE4NTAyNTM1NDE3IDI0ODE0MjczMTE1MjUxMzI=