Exemplo n.º 1
0
 /**
  * @dataProvider getParserAndGeneratorTests
  */
 public function testApply($diff, $before, $after)
 {
     $this->assertEquals($after, DiffUtils::apply($before, $diff));
     $this->assertEquals($before, DiffUtils::reverseApply($after, $diff));
 }
Exemplo n.º 2
0
 public function getOriginalFile()
 {
     if (null === $this->diff) {
         throw new \LogicException('getOriginalFile() is only available after setDiff() has been called.');
     }
     if (null !== $this->originalFile) {
         return $this->originalFile;
     }
     if ($this->isNew()) {
         return self::create($this->name, '');
     }
     // TODO: What about files which have been renamed?
     return $this->originalFile = self::create($this->name, DiffUtils::reverseApply($this->content, $this->diff));
 }