mirror of
https://github.com/friendica/friendica
synced 2025-03-23 04:59:36 +00:00
Add tests for Container::fromBasePath()
This commit is contained in:
parent
37ffeb8121
commit
316fac0161
1 changed files with 33 additions and 0 deletions
|
@ -11,12 +11,45 @@ namespace Core;
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Container;
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
class ContainerTest extends TestCase
|
||||
{
|
||||
public function testFromBasePathReturnsContainer(): void
|
||||
{
|
||||
$root = vfsStream::setup('friendica', null, [
|
||||
'static' => [
|
||||
'dependencies.config.php' => '<?php return [];',
|
||||
],
|
||||
]);
|
||||
|
||||
$container = Container::fromBasePath($root->url());
|
||||
|
||||
$this->assertInstanceOf(Container::class, $container);
|
||||
}
|
||||
|
||||
public function testCreateReturnsObject(): void
|
||||
{
|
||||
$root = vfsStream::setup('friendica', null, [
|
||||
'static' => [
|
||||
'dependencies.config.php' => <<< PHP
|
||||
<?php return [
|
||||
\Psr\Log\LoggerInterface::class => [
|
||||
'instanceOf' => \Psr\Log\NullLogger::class,
|
||||
],
|
||||
];
|
||||
PHP,
|
||||
],
|
||||
]);
|
||||
|
||||
$container = Container::fromBasePath($root->url());
|
||||
|
||||
$this->assertInstanceOf(NullLogger::class, $container->create(LoggerInterface::class));
|
||||
}
|
||||
|
||||
public function testFromDiceReturnsContainer(): void
|
||||
{
|
||||
$dice = $this->createMock(Dice::class);
|
||||
|
|
Loading…
Add table
Reference in a new issue