8000 [DI] Do not process bindings in AbstractRecursivePass by chalasr · Pull Request #24602 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DI] Do not process bindings in AbstractRecursivePass #24602

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

Merged
merged 1 commit into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
8000
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ protected function processValue($value, $isRoot = false)
$value->setArguments($this->processValue($value->getArguments()));
$value->setProperties($this->processValue($value->getProperties()));
$value->setMethodCalls($this->processValue($value->getMethodCalls()));
$value->setBindings($this->processValue($value->getBindings()));
Copy link
Contributor
@dmaicher dmaicher Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a test case for this? for example within the RemoveUnusedDefinitionsPassTest?

Copy link
Contributor
@dmaicher dmaicher Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I mean the test for the pass that checks if services exist ;p

==> CheckExceptionOnInvalidReferenceBehaviorPassTest

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test added


$changes = $value->getChanges();
if (isset($changes['factory'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -88,6 +89,20 @@ public function testProcessThrowsExceptionOnNonSharedUninitializedReference()
$this->process($container);
}

public function testProcessDefinitionWithBindings()
{
$container = new ContainerBuilder();

$container
->register('b')
->setBindings(array(new BoundArgument(new Reference('a'))))
;

$this->process($container);

$this->addToAssertionCount(1);
}

private function process(ContainerBuilder $container)
{
$pass = new CheckExceptionOnInvalidReferenceBehaviorPass();
Expand Down
0