*/ class StateValidationTest extends TestCase { /** * Create a dummy variable for a DeliveryExecution * @return DeliveryExecution the dummy variable */ protected function getDeliveryExecution($state) { $prophet = new \Prophecy\Prophet(); $prophecyState = $prophet->prophesize(\core_kernel_classes_Resource::class); $prophecyState->getUri()->willReturn($state); $prophet = new \Prophecy\Prophet(); $prophecy = $prophet->prophesize(); $prophecy->willImplement(DeliveryExecutionInterface::class); $prophecy->getState()->willReturn($prophecyState->reveal()); return $prophecy->reveal(); } /** * Create a dummy variable for a User * @return User the dummy variable */ protected function getUser() { $prophet = new \Prophecy\Prophet(); $prophecy = $prophet->prophesize(); $prophecy->willImplement(User::class); return $prophecy->reveal(); } /** * Test the DeliveryAuthorizationProvider#isAuthorized method */ public function testNotAuthorized() { $this->expectException(common_exception_Unauthorized::class); $validator = new StateValidation(); $validator->verifyResumeAuthorization($this->getDeliveryExecution(DeliveryExecution::STATE_FINISHED), $this->getUser()); } }