Phalcon\Test\Unit\DiTest::testGetShared PHP Метод

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

Tests resolving shared service
С версии: 2016-01-29
Автор: Serghei Iakovlev ([email protected])
public testGetShared ( )
    public function testGetShared()
    {
        $this->specify("Resolving shared service does now work correctly", function () {
            $this->phDi->set('dateObject', function () {
                $object = new \stdClass();
                $object->date = microtime(true);
                return $object;
            });
            $dateObject = $this->phDi->getShared('dateObject');
            usleep(5000);
            $dateObject2 = $this->phDi->getShared('dateObject');
            expect($dateObject)->equals($dateObject2);
            expect($dateObject->date)->equals($dateObject2->date);
        });
    }