public function testCompilerPassIteratorAndCountable()
 {
     $collection = new CompilerPassCollection();
     $collection->addCompiler($compiler_x = new DummyCompilerPass('definition-x', true), 100);
     $collection->addCompiler($compiler_y = new DummyCompilerPass('definition-y'), 500);
     $collection->addCompiler($compiler_z = new DummyCompilerPass('definition-z'), -500);
     $collection->addCompiler($compiler_t = new DummyCompilerPass('definition-t'), 500);
     $collection->addCompiler($compiler_w = new DummyCompilerPass('definition-w'), 500);
     $this->assertSame(5, count($collection));
     $iterationResult = [];
     foreach ($collection as $compiler) {
         $iterationResult[] = $compiler;
     }
     $this->assertSame(array($compiler_z, $compiler_x, $compiler_y, $compiler_t, $compiler_w), $iterationResult);
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function compile(ContainerInterface $container)
 {
     return $this->compilers->process($container);
 }