public function testOnRestoreFail() { $exception = $this->prophesize(\Exception::class); $this->event->getOption('parameter')->willReturn(['directory' => '/test']); $this->event->getOption('plugin')->willReturn('test'); $this->event->setStatus(BackupStatus::STATE_FAILED)->shouldBeCalled(); $this->event->setException($exception->reveal())->shouldBeCalled(); $source = $this->prophesize(Filesystem::class); $destination = $this->prophesize(Filesystem::class); $database = $this->prophesize(Database::class); $this->event->getSource()->willReturn($source->reveal()); $this->event->getDestination()->willReturn($destination->reveal()); $this->event->getDatabase()->willReturn($database->reveal()); $plugin = $this->prophesize(PluginInterface::class); $plugin->configureOptionsResolver(Argument::type(OptionsResolver::class))->will(function ($arguments) { /** @var OptionsResolver $optionResolver */ $optionsResolver = $arguments[0]; $optionsResolver->setRequired('directory'); }); $plugin->restore($source->reveal(), $destination->reveal(), $database->reveal(), ['directory' => '/test'])->shouldBeCalled()->willThrow($exception->reveal()); $this->pluginRegistry->getPlugin('test')->willReturn($plugin->reveal()); $this->listener->onRestore($this->event->reveal()); }