mirror of
https://github.com/friendica/friendica
synced 2025-01-31 21:39:46 +00:00
Remove DiceContainer::fromDice()
This commit is contained in:
parent
320fe18654
commit
c762c62029
2 changed files with 1 additions and 42 deletions
|
@ -27,7 +27,7 @@ final class DiceContainer implements Container
|
|||
|
||||
$dice = (new Dice())->addRules(require($path));
|
||||
|
||||
return static::fromDice($dice);
|
||||
return new self($dice);
|
||||
}
|
||||
|
||||
private Dice $container;
|
||||
|
@ -37,18 +37,6 @@ final class DiceContainer implements Container
|
|||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance with Dice
|
||||
*
|
||||
* @param Dice $container
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromDice(Dice $container): self
|
||||
{
|
||||
return new self($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the container with the given parameters
|
||||
*
|
||||
|
|
|
@ -50,33 +50,4 @@ class DiceContainerTest extends TestCase
|
|||
|
||||
$this->assertInstanceOf(NullLogger::class, $container->create(LoggerInterface::class));
|
||||
}
|
||||
|
||||
public function testFromDiceReturnsContainer(): void
|
||||
{
|
||||
$dice = $this->createMock(Dice::class);
|
||||
$dice->expects($this->never())->method('create');
|
||||
|
||||
$container = DiceContainer::fromDice($dice);
|
||||
|
||||
$this->assertInstanceOf(Container::class, $container);
|
||||
}
|
||||
|
||||
public function testCreateFromContainer(): void
|
||||
{
|
||||
$dice = $this->createMock(Dice::class);
|
||||
$dice->expects($this->once())->method('create')->with(LoggerInterface::class)->willReturn(new NullLogger());
|
||||
|
||||
$container = DiceContainer::fromDice($dice);
|
||||
|
||||
$this->assertInstanceOf(NullLogger::class, $container->create(LoggerInterface::class));
|
||||
}
|
||||
|
||||
public function testAddRuleFromContainer(): void
|
||||
{
|
||||
$dice = $this->createMock(Dice::class);
|
||||
$dice->expects($this->once())->method('addRule')->with(LoggerInterface::class, ['constructParams' => ['console']])->willReturn($dice);
|
||||
|
||||
$container = DiceContainer::fromDice($dice);
|
||||
$container->addRule(LoggerInterface::class, ['constructParams' => ['console']]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue