예제 #1
0
 public function testOnPreRestore()
 {
     $event = $this->prophesize(PreRestoreEvent::class);
     $event->getBackup()->willReturn(['test1' => 1, 'test2' => 2]);
     $event->setBackup(['test1' => 1, 'test2' => 2, 'test3' => 3])->shouldBeCalled();
     $this->presetStore->getPreset($this->application, $this->version, $this->options)->willReturn(['test2' => 3, 'test3' => 3]);
     $this->listener->onPreRestore($event->reveal());
 }
예제 #2
0
 private function getCommandTester($remote = false, $backup = [])
 {
     $this->container->getParameter('nanbando.storage.local_directory')->willReturn('/User/test/nanbando');
     $this->container->getParameter('nanbando.backup')->willReturn($backup);
     $this->container->hasParameter('nanbando.application.name')->willReturn(true);
     $this->container->getParameter('nanbando.application.name')->willReturn('sulu');
     $this->container->hasParameter('nanbando.application.version')->willReturn(true);
     $this->container->getParameter('nanbando.application.version')->willReturn('1.3');
     $this->container->hasParameter('nanbando.application.options')->willReturn(true);
     $this->container->getParameter('nanbando.application.options')->willReturn([]);
     $this->container->has('filesystem.remote')->willReturn($remote);
     $this->container->get('presets')->willReturn($this->presetStore->reveal());
     $this->container->get('plugins')->willReturn($this->plugins->reveal());
     $command = new CheckCommand();
     $command->setContainer($this->container->reveal());
     $application = new Application();
     $application->add($command);
     $command = $application->find('check');
     return new CommandTester($command);
 }
예제 #3
0
 /**
  * Extend backup with preset.
  *
  * @param array $backup
  *
  * @return array
  */
 private function extend(array $backup)
 {
     $preset = $this->presetStore->getPreset($this->application, $this->version, $this->options);
     return array_merge($preset, $backup);
 }
예제 #4
0
 /**
  * @dataProvider presetProvider
  *
  * @param array $presets
  * @param string $application
  * @param string $version
  * @param array|null $options
  * @param array $expects
  */
 public function testGetPreset($presets, $application, $version, $options, $expects)
 {
     $presetStore = new PresetStore($presets);
     $this->assertEquals($expects, $presetStore->getPreset($application, $version, $options));
 }