diff --git a/src/Client.php b/src/Client.php index 8be5ac4..5ceaf49 100644 --- a/src/Client.php +++ b/src/Client.php @@ -45,7 +45,7 @@ public function fetchFile($path, $revision = null) $url = $path . '?view=co'; if ($revision !== null) { - $url .= '&revision=' . $revision; + $url .= '&pathrev=' . $revision; } // TODO: fetching a directory redirects to path with trailing slash diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 0434d0c..8332c83 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -48,4 +48,13 @@ public function testFetchFileExcessiveSlashesAreIgnored() $this->expectPromiseReject($promise); } + + public function testFetchFileRevision() + { + $this->browser->expects($this->once())->method('get')->with($this->equalTo('http://viewvc.example.org/README.md?view=co&pathrev=1.0'))->will($this->returnValue($this->createPromiseRejected())); + + $promise = $this->client->fetchFile('/README.md', '1.0'); + + $this->expectPromiseReject($promise); + } } diff --git a/tests/FunctionalClientTest.php b/tests/FunctionalClientTest.php index f483538..ba4c582 100644 --- a/tests/FunctionalClientTest.php +++ b/tests/FunctionalClientTest.php @@ -44,6 +44,17 @@ public function testFetchFile() $this->assertStringStartsWith('/*', $recipe); } + public function testFetchFileOldFileNowDeletedButRevisionAvailable() + { + $file = 'commons/STATUS'; + $revision = '1'; + + $promise = $this->viewvc->fetchFile($file, $revision); + $contents = $this->waitFor($promise); + + $this->assertStringStartsWith('APACHE COMMONS', $contents); + } + /** * @expectedException RuntimeException */