8000 [TwigBundle] Added priority to twig extensions by Brunty · Pull Request #24777 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] Added priority to twig extensions #24777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[TwigBundle] Remove TwigEngironmentPassTest setUp method
Moves the properties on the test class to variables inside the single test method it has.
  • Loading branch information
Brunty committed Jan 16, 2018
commit 9e8d1f5107cc39a2ede42029cba0d4c74fcbe5b2
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,25 @@

class TwigEnvironmentPassTest extends TestCase
{
/**
* @var ContainerBuilder
*/
private $builder;
/**
* @var Definition
*/
private $definition;
/**
* @var TwigEnvironmentPass
*/
private $pass;

protected function setUp()
{
$this->builder = new ContainerBuilder();
$this->definition = new Definition('twig');
$this->definition->setPublic(true);
$this->builder->setDefinition('twig', $this->definition);

$this->pass = new TwigEnvironmentPass();
}

public function testPassWithTwoExtensionsWithPriority()
{
$twigDefinition = new Definition('twig');
$twigDefinition->setPublic(true);
$builder = new ContainerBuilder();
$builder->setDefinition('twig', $twigDefinition);
$pass = new TwigEnvironmentPass();

$definition = new Definition('test_extension_1');
$definition->addTag('twig.extension', array('priority' => 100));
$this->builder->setDefinition('test_extension_1', $definition);
$builder->setDefinition('test_extension_1', $definition);

$definition = new Definition('test_extension_2');
$definition->addTag('twig.extension', array('priority' => 200));
$this->builder->setDefinition('test_extension_2', $definition);
$builder->setDefinition('test_extension_2', $definition);

$this->pass->process($this->builder);
$calls = $this->definition->getMethodCalls();
$pass->process($builder);
$calls = $twigDefinition->getMethodCalls();
$this->assertCount(2, $calls);
$this->assertEquals('addExtension', $calls[0][0]);
$this->assertEquals('addExtension', $calls[1][0]);
Expand Down
0