NamedServicesReconstructor - add test for double use of one service

This commit is contained in:
TomasVotruba 2017-07-16 21:14:57 +02:00
parent 885a4e4f03
commit 4fe18bacab
3 changed files with 30 additions and 8 deletions

View File

@ -9,15 +9,10 @@ final class Test extends AbstractReconstructorTestCase
{
public function test(): void
{
$this->doTestFileMatchesExpectedContent(
__DIR__ . '/wrong/wrong.php.inc',
__DIR__ . '/correct/correct.php.inc'
);
$this->doTestFileMatchesExpectedContent(
__DIR__ . '/wrong/wrong2.php.inc',
__DIR__ . '/correct/correct2.php.inc'
$this->doTestFileMatchesExpectedContent(__DIR__ . '/wrong/wrong.php.inc', __DIR__ . '/correct/correct.php.inc');
$this->doTestFileMatchesExpectedContent(__DIR__ . '/wrong/wrong2.php.inc', __DIR__ . '/correct/correct2.php.inc'
);
$this->doTestFileMatchesExpectedContent(__DIR__ . '/wrong/wrong3.php.inc', __DIR__ . '/correct/correct3.php.inc');
}
protected function getReconstructorClass(): string

View File

@ -0,0 +1,17 @@
<?php declare (strict_types=1);
class ClassWitNamedService implements ContainerAwareInterface
{
/**
* @var stdClass
*/
private $stdClass;
public function __construct(stdClass $stdClass)
{
$this->stdClass = $stdClass;
}
public function render()
{
$someService = $this->stdClass;
$someResult = $this->stdClass->callMe();
}
}

View File

@ -0,0 +1,10 @@
<?php declare (strict_types=1);
class ClassWitNamedService implements ContainerAwareInterface
{
public function render()
{
$someService = $this->get('some.class');
$someResult = $this->get('some.class')->callMe();
}
}