Пример #1
0
 /**
  * Compares two Results
  *
  * @param Robo47_DirectoryHasher_Result $old
  * @param Robo47_DirectoryHasher_Result $new
  * @return Robo47_DirectoryHasher_Comparator_Result
  */
 public function compare(Robo47_DirectoryHasher_Result $old, Robo47_DirectoryHasher_Result $new)
 {
     $result = new Robo47_DirectoryHasher_Comparator_Result();
     foreach ($old->getIterator() as $fileResult) {
         /* @var $fileResult Robo47_DirectoryHasher_Result_File */
         if (!$new->hasFileResultFor($fileResult->getFilename())) {
             $result->addDifference(new Robo47_DirectoryHasher_Comparator_Difference_MissingFile($fileResult->getFilename()));
         } else {
             $result->addDifferences($this->getHashDifferences($fileResult, $new->getFileResultFor($fileResult->getFilename())));
         }
     }
     foreach ($new->getIterator() as $fileResult) {
         /* @var $fileResult Robo47_DirectoryHasher_Result_File */
         if (!$old->hasFileResultFor($fileResult->getFilename())) {
             $result->addDifference(new Robo47_DirectoryHasher_Comparator_Difference_NewFile($fileResult->getFilename()));
         }
     }
     return $result;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function getFileResults()
 {
     $this->loadSources();
     return $this->result->getIterator()->getArrayCopy();
 }
Пример #3
0
 /**
  * @covers Robo47_DirectoryHasher_Result::getIterator
  */
 public function testGetIterator()
 {
     $result = new Robo47_DirectoryHasher_Result();
     $this->assertInstanceOf('ArrayIterator', $result->getIterator());
 }