8000 Fix bug when using an private aliased factory service by wouterj · Pull Request #17942 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix bug when using an private aliased factory service #17942

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 2 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
Add failing test case
  • Loading branch information
wouterj committed Feb 27, 2016
commit 70c32c4af686a5c6cde6c084430d6d1bf68e9e9d
8000
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

require_once __DIR__.'/../Fixtures/includes/foo.php';

class ReplaceAliasByActualDefinitionPassTest extends \PHPUnit_Framework_TestCase
{
public function testProcess()
Expand Down Expand Up @@ -44,6 +46,26 @@ public function testProcess()
$this->assertSame('b_alias', $aDefinition->getFactoryService());
}

/**
* @group legacy
Copy link
Member Author

Choose a reason for hiding this comment

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

it's not really legacy in 2.3, but this makes things easier to merge to 2.7/2.8

*/
public function testPrivateAliasesInFactory()
{
$container = new ContainerBuilder();

$container->register('a', 'FooClass');
$container->register('b', 'FooClass')
->setFactoryService('a')
->setFactoryMethod('getInstance');

$container->register('c', 'stdClass')->setPublic(false);
$container->setAlias('c_alias', 'c');

$this->process($container);

$this->assertInstanceOf('FooClass', $container->get('b'));
}

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
0