Elgg\Di\DiContainerTest::testSetFactoryShared PHP Метод

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

    public function testSetFactoryShared()
    {
        $di = new \Elgg\Di\DiContainer();
        $this->assertSame($di, $di->setFactory('foo', array($this, 'getFoo')));
        $this->assertTrue($di->has('foo'));
        $foo1 = $di->foo;
        $foo2 = $di->foo;
        $this->assertInstanceOf(self::TEST_CLASS, $foo1);
        $this->assertSame($foo1, $foo2);
    }