/**
  * @test
  */
 public function slaveFailWillNotFailBackup()
 {
     $this->clearDestination();
     $master = new LocalDestination($this->directory . DIRECTORY_SEPARATOR . 'destination1');
     $slave = $this->getMockBuilder('RunOpenCode\\Backup\\Contract\\DestinationInterface')->getMock();
     $slave->method('push')->willThrowException(new DestinationException());
     $replica = new ReplicatedDestination($master, $slave);
     $replica->setLogger(new NullLogger());
     $files = $this->fetchSomeFiles();
     $replica->push(new Backup('test_backup', $files));
     $cleanDestination = new LocalDestination($this->directory . DIRECTORY_SEPARATOR . 'destination1');
     $this->assertTrue($cleanDestination->has('test_backup'), 'Master has backup.');
     $this->assertSame(count($files), count($cleanDestination->get('test_backup')->getFiles()), 'Master has same files.');
 }
 /**
  * @test
  */
 public function twoStreamDestinations()
 {
     $this->clearDestination();
     $destination1 = new LocalDestination($this->directory . DIRECTORY_SEPARATOR . 'destination1');
     $destination2 = new LocalDestination($this->directory . DIRECTORY_SEPARATOR . 'destination2');
     $theCollection = new DestinationCollection();
     $theCollection->addDestination($destination1)->addDestination($destination2);
     $files = $this->fetchSomeFiles();
     $theCollection->push(new Backup('test_backup', $files));
     foreach (array($this->directory . DIRECTORY_SEPARATOR . 'destination1', $this->directory . DIRECTORY_SEPARATOR . 'destination2') as $directory) {
         $cleanDestination = new LocalDestination($directory);
         $this->assertTrue($cleanDestination->has('test_backup'), 'Each destination has backup.');
         $this->assertSame(count($files), count($cleanDestination->get('test_backup')->getFiles()), 'Each backup has same files.');
     }
 }