-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix generation of containers using a base class
Since the introduction of the container namespace, we must be explicitly set the FQCN of the base class (with its leading slash). Without that, Symfony generates a dump pointing to the wrong class. Signed-off-by: Luís Cobucci <[email protected]>
- Loading branch information
Showing
5 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Lcobucci\DependencyInjection; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \Lcobucci\DependencyInjection\ContainerBuilder | ||
* @covers \Lcobucci\DependencyInjection\Compiler | ||
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag | ||
* @covers \Lcobucci\DependencyInjection\Config\ContainerConfiguration | ||
* @covers \Lcobucci\DependencyInjection\Generator | ||
* @covers \Lcobucci\DependencyInjection\Generators\Xml | ||
* @covers \Lcobucci\DependencyInjection\Testing\MakeServicesPublic | ||
*/ | ||
final class CompilationWithBaseClassTest extends TestCase | ||
{ | ||
use GeneratesDumpDirectory; | ||
|
||
private const DI_NAMESPACE = 'Lcobucci\\DiTests\\BaseClass'; | ||
|
||
/** @test */ | ||
public function containerCanHaveACustomBaseClass(): void | ||
{ | ||
$container = ContainerBuilder::default(__FILE__, self::DI_NAMESPACE) | ||
->setBaseClass(ContainerForTests::class) | ||
->setDumpDir($this->dumpDirectory) | ||
->getContainer(); | ||
|
||
self::assertInstanceOf(ContainerForTests::class, $container); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Lcobucci\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\Container; | ||
|
||
abstract class ContainerForTests extends Container | ||
{ | ||
} |