4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Tests\Compiler;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16 use Symfony\Component\DependencyInjection\Compiler\PassConfig;
19 * @author Guilhem N <egetick@gmail.com>
21 class PassConfigTest extends TestCase
23 public function testPassOrdering()
25 $config = new PassConfig();
26 $config->setBeforeOptimizationPasses(array());
28 $pass1 = $this->getMockBuilder(CompilerPassInterface::class)->getMock();
29 $config->addPass($pass1, PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
31 $pass2 = $this->getMockBuilder(CompilerPassInterface::class)->getMock();
32 $config->addPass($pass2, PassConfig::TYPE_BEFORE_OPTIMIZATION, 30);
34 $passes = $config->getBeforeOptimizationPasses();
35 $this->assertSame($pass2, $passes[0]);
36 $this->assertSame($pass1, $passes[1]);