* * 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:----iflmrxb/Irsv/TIJJ5xysekcvAG9YLRNdY9fijXfk+24p1eDmrc+hffmeBv61eooGCBTH6FTmoSrfJpxQrKRA+dkJM6bslt+euz/h4A+qPpQy5q80NsjxAYfBEJg6hXI9pY8KPSSwc+zuZsFSEgZGwH6cx+Ijot2CPW+osBjnfngfT0P+kS4BJnm8vjttxkCKT56WASu+Bbm7Y2vvy35beI6f7xjWURIEpBTMkmHUKmveddj+oxwj4IlTABvcMZ32FswHtpkhFhvT11alDDPOiwyJrQZGhJXllU3LQkEAHuRD0meqTxi5wOk+93JKh7+4n8AuFQskrTAD91hnL+/LEWNFbqCbp/Pb5ehUhk6io9u9EMnZyK5SVihtHCxV9QSC7rUSYsZWQaUV8CrB+8QlnrU32TvCWI8F4tamd1XvwY6BRLJUtKQZsPh1VSLwq0Asf0Eldldc1fWg1txeChgP9jPEISEsJXxhPXTBUQUpedu3SpqZlWAfo/PwURRsQkcswdllw3CummT4Na+iyh8gmOzzzookalcKRzSs963mVxpKn3M9gDBGfJl6D87pdaod2S/bnfvYYnkF8eZGIudG+/u52vfC6lvSKAcDN8VFvRxS0AutGWlr+jVHLOAPhZS/DxIvnmWsoOVPdTYTI6ggOQ75dxbF8HKNkP4aA7ogv4=----ATTACHMENT:----NjE1NDc3NjgyODI5MzI0NiA3MTczMjEzNDAyMTgzMDUzIDQzODAyMjQwMzY5MjQwNTM=