prophesize('core_kernel_classes_Resource'); $owner = $this->prophesize('core_kernel_classes_Resource'); $owner->getUri()->willReturn('#ownerUri'); $lock = new OntoLockData($resource->reveal(), $owner->reveal(), 'epoch'); $this->assertInstanceOf('core_kernel_classes_Resource', $lock->getOwner()); $this->assertEquals('#ownerUri', $lock->getOwner()->getUri()); } /** * * @author Lionel Lecaque, lionel@taotesting.com */ public function testToJson() { $resource = $this->prophesize('core_kernel_classes_Resource'); $owner = $this->prophesize('core_kernel_classes_Resource'); $owner->getUri()->willReturn('#ownerUri'); $resource->getUri()->willReturn('#resourceUri'); $lock = new OntoLockData($resource->reveal(), $owner->reveal(), 'epoch'); $expected = json_encode([ 'resource' => '#resourceUri', 'owner' => '#ownerUri', 'epoch' => 'epoch' ]); $this->assertEquals($expected, $lock->toJson()); } /** * @author Lionel Lecaque, lionel@taotesting.com */ public function testGetLockDataExeption() { $this->expectException(common_exception_InconsistentData::class); OntoLockData::getLockData(json_encode([])); } }