/** * @dataProvider getParserAndGeneratorTests */ public function testApply($diff, $before, $after) { $this->assertEquals($after, DiffUtils::apply($before, $diff)); $this->assertEquals($before, DiffUtils::reverseApply($after, $diff)); }
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)); }