-
-
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.
Merge pull request #511 from lcobucci/7.2.x-merge-up-into-7.3.x_5GRbHxfj
Merge release 7.2.2 into 7.3.x
- Loading branch information
Showing
9 changed files
with
116 additions
and
49 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
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,34 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Lcobucci\DependencyInjection; | ||
|
||
use Lcobucci\DependencyInjection\Compiler\ParameterBag; | ||
use Lcobucci\DependencyInjection\Config\ContainerConfiguration; | ||
use Lcobucci\DependencyInjection\Generators\Xml; | ||
use PHPUnit\Framework\Attributes as PHPUnit; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[PHPUnit\CoversClass(ContainerBuilder::class)] | ||
#[PHPUnit\CoversClass(Compiler::class)] | ||
#[PHPUnit\CoversClass(ParameterBag::class)] | ||
#[PHPUnit\CoversClass(ContainerConfiguration::class)] | ||
#[PHPUnit\CoversClass(Generator::class)] | ||
#[PHPUnit\CoversClass(Xml::class)] | ||
final class CompilationWithBaseClassTest extends TestCase | ||
{ | ||
use GeneratesDumpDirectory; | ||
|
||
private const DI_NAMESPACE = 'Lcobucci\\DiTests\\BaseClass'; | ||
|
||
#[PHPUnit\Test] | ||
public function containerCanHaveACustomBaseClass(): void | ||
{ | ||
$container = ContainerBuilder::xml(__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
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 | ||
{ | ||
} |
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,37 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Lcobucci\DependencyInjection; | ||
|
||
use PHPUnit\Framework\Attributes as PHPUnit; | ||
|
||
use function assert; | ||
use function exec; | ||
use function is_string; | ||
use function mkdir; | ||
use function tempnam; | ||
use function unlink; | ||
|
||
trait GeneratesDumpDirectory | ||
{ | ||
private string $dumpDirectory; | ||
|
||
#[PHPUnit\Before] | ||
public function createDumpDir(): void | ||
{ | ||
mkdir(__DIR__ . '/../tmp'); | ||
|
||
$tempName = tempnam(__DIR__ . '/../tmp', 'lcobucci-di-builder'); | ||
assert(is_string($tempName)); | ||
|
||
$this->dumpDirectory = $tempName; | ||
unlink($this->dumpDirectory); | ||
mkdir($this->dumpDirectory); | ||
} | ||
|
||
#[PHPUnit\After] | ||
public function removeDumpDir(): void | ||
{ | ||
exec('rm -rf ' . __DIR__ . '/../tmp'); | ||
} | ||
} |
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