getId() public method

public getId ( ) : string
return string
Beispiel #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);
 }