public function testProcessThrowsExceptionIfTraitsAreNotAvailable()
 {
     if (!$this->hasTraits) {
         $this->setExpectedException('\\Symfony\\Component\\Config\\Definition\\Exception\\InvalidConfigurationException', 'PHP >= 5.4.0 is required to use traits.');
     }
     $config = array('extensions' => array('sonata_extension_post' => array('uses' => array('Sonata\\AdminBundle\\Tests\\Fixtures\\DependencyInjection\\TimestampableTrait'))));
     $container = $this->getContainer();
     $this->extension->load(array($config), $container);
     $extensionsPass = new ExtensionCompilerPass();
     $extensionsPass->process($container);
     $container->compile();
 }
 /**
  * @covers Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass::process
  */
 public function testProcess()
 {
     $container = $this->getContainer();
     $this->extension->load(array($this->config), $container);
     $extensionsPass = new ExtensionCompilerPass();
     $extensionsPass->process($container);
     $container->compile();
     $this->assertTrue($container->hasDefinition('sonata_extension_publish'));
     $this->assertTrue($container->hasDefinition('sonata_extension_history'));
     $this->assertTrue($container->hasDefinition('sonata_extension_order'));
     $this->assertTrue($container->hasDefinition('sonata_extension_security'));
     $this->assertTrue($container->hasDefinition('sonata_post_admin'));
     $this->assertTrue($container->hasDefinition('sonata_article_admin'));
     $this->assertTrue($container->hasDefinition('sonata_news_admin'));
     $def = $container->get('sonata_post_admin');
     $extensions = $def->getExtensions();
     $this->assertCount(4, $extensions);
     $this->assertInstanceOf(get_class($this->securityExtension), $extensions[0]);
     $this->assertInstanceOf(get_class($this->publishExtension), $extensions[2]);
     $this->assertInstanceOf(get_class($this->historyExtension), $extensions[3]);
     $def = $container->get('sonata_article_admin');
     $extensions = $def->getExtensions();
     $this->assertCount(5, $extensions);
     $this->assertInstanceOf(get_class($this->securityExtension), $extensions[0]);
     $this->assertInstanceOf(get_class($this->publishExtension), $extensions[1]);
     $this->assertInstanceOf(get_class($this->orderExtension), $extensions[3]);
     $this->assertInstanceOf(get_class($this->filterExtension), $extensions[4]);
     $def = $container->get('sonata_news_admin');
     $extensions = $def->getExtensions();
     $this->assertCount(5, $extensions);
     $this->assertInstanceOf(get_class($this->securityExtension), $extensions[0]);
     $this->assertInstanceOf(get_class($this->orderExtension), $extensions[1]);
     $this->assertInstanceOf(get_class($this->historyExtension), $extensions[3]);
     $this->assertInstanceOf(get_class($this->filterExtension), $extensions[4]);
 }