/**
* @param string $original
* @param string $new
* @param string $patchFile
*
* @return string
*/
protected function createPatch($original, $new, $patchFile)
{
$process = ProcessBuilder::create(['diff', '-uN', $new, $original])->setWorkingDirectory($this->tmpFolder)->getProcess();
$process->run();
if (!$process->isSuccessful() && $process->getExitCode() !== 1) {
throw new PatchException('Diff failed: ' . $process->getOutput());
}
$patchData = $process->getOutput();
$this->filesystem->putFileContents($patchFile, $patchData);
return $patchData;
}