OrnoTest\ContainerTest::testStoresAndInvokesClosureWithDefinedArguments PHP Метод

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

    public function testStoresAndInvokesClosureWithDefinedArguments()
    {
        $c = new Container();
        $baz = new \OrnoTest\Assets\Baz();
        $bar = new \OrnoTest\Assets\Bar($baz);
        $c->add('foo', function ($bar, $baz) {
            $foo = new \OrnoTest\Assets\Foo($bar);
            $foo->injectBaz($baz);
            return $foo;
        })->withArguments([$bar, $baz]);
        $foo = $c->get('foo');
        $this->assertInstanceOf('OrnoTest\\Assets\\Foo', $foo);
        $this->assertInstanceOf('OrnoTest\\Assets\\Bar', $foo->bar);
        $this->assertInstanceOf('OrnoTest\\Assets\\Baz', $foo->baz);
    }
ContainerTest