/** * @test */ public function it_should_pass_the_original_update_from_cdbxml_command_to_the_wrapped_command_handler() { $command = new UpdateEventFromCdbXml(new String('foo'), new EventXmlString(file_get_contents(__DIR__ . '/Valid.xml'))); $this->security->expects($this->once())->method('allowsUpdateWithCdbXml')->with(new String('foo'))->willReturn(true); $this->wrappedCommandHandler->expects($this->once())->method('handle')->with($command); $this->commandHandler->handle($command); }
/** * @param $command */ private function guardPermissions($command) { $allowed = true; if ($command instanceof UpdateEventFromCdbXml) { $allowed = $this->security->allowsUpdateWithCdbXml($command->getEventId()); } if (!$allowed) { throw new AccessDeniedHttpException(); } }