Nelmio\Alice\Definition\Object\CompleteObject::getId PHP Метод

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

public getId ( ) : string
Результат string
    public function getId() : string
    {
        return $this->object->getId();
    }

Usage Example

Пример #1
0
 public function testDecoratesAnObject()
 {
     $decoratedObjectProphecy = $this->prophesize(ObjectInterface::class);
     $decoratedObjectProphecy->getId()->willReturn('dummy');
     $decoratedObjectProphecy->getInstance()->willReturn(new \stdClass());
     /** @var ObjectInterface $decoratedObject */
     $decoratedObject = $decoratedObjectProphecy->reveal();
     $object = new CompleteObject($decoratedObject);
     $this->assertEquals('dummy', $object->getId());
     $decoratedObjectProphecy->getId()->shouldHaveBeenCalledTimes(1);
     $decoratedObjectProphecy->getInstance()->shouldHaveBeenCalledTimes(0);
     $this->assertEquals(new \stdClass(), $object->getInstance());
     $decoratedObjectProphecy->getId()->shouldHaveBeenCalledTimes(1);
     $decoratedObjectProphecy->getInstance()->shouldHaveBeenCalledTimes(1);
 }