Kraken\_Module\Container\ContainerTest::testApiRemove_RemovesDefinition_WhenDefinitionPointsToFactoryMethod PHP Метод

testApiRemove_RemovesDefinition_WhenDefinitionPointsToFactoryMethod() публичный Метод

    public function testApiRemove_RemovesDefinition_WhenDefinitionPointsToFactoryMethod()
    {
        $c = $this->createContainer();
        $baz = new Baz();
        $c->factory(Baz::class, function () use($baz) {
            return $baz;
        });
        $make = $c->make(Baz::class);
        $this->assertInstanceOf(Baz::class, $make);
        $this->assertSame($baz, $make);
        $c->remove(Baz::class);
        $make = $c->make(Baz::class);
        $this->assertInstanceOf(Baz::class, $make);
        $this->assertNotSame($baz, $make);
    }
ContainerTest