public function diff(Version $oldVersion, Version $newVersion) { $head = $this->getHead($oldVersion); $this->client->setHead($head); $result = $this->client->diff($this->getHead($oldVersion), $this->getHead($newVersion), $oldVersion->getBuild(), $newVersion->getBuild()); return $result; }
/** * @dataProvider existingPathProvider */ public function testDiff($filename) { // first we need a checkout $result = $this->client->checkout($this->checkoutDir); // next modify a file $tmpfile = $this->checkoutDir . '/' . $filename; file_put_contents($tmpfile, uniqid(null, true)); // added to the staged file list $this->client->add($filename); // now let's commit it $this->client->commit("changed file contents"); // get the log $log = $this->client->log($filename); $firstLog = end($log); $firstRevision = $firstLog->getRevision(); $diff = $this->client->diff($filename, $filename, $firstRevision); $file = new VcsFileInfo($filename, $this->client->getHead()); $file->setStatus(Status::MODIFIED); $expected = array($file); $this->assertContainsOnlyInstancesOf('Webcreate\\Vcs\\Common\\VcsFileInfo', $diff); $this->assertEquals($expected, $diff); }