File tree Expand file tree Collapse file tree 2 files changed +31
-8
lines changed
Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,7 @@ public function parseLogRevisions(SimpleXMLElement $xml)
4141 }
4242
4343 // href contains r1 and r2 as query parameters
44- $ href = (string )$ anchor ['href ' ];
45- $ pos = strpos ($ href , '? ' );
46- if ($ pos === false ) {
47- continue ;
48- }
49-
50- $ args = array ();
51- parse_str (substr ($ href , $ pos + 1 ), $ args );
44+ $ args = $ this ->linkParameters ((string )$ anchor ['href ' ]);
5245
5346 // all links containing r2 are links to previous revision
5447 if (isset ($ args ['r2 ' ])) {
@@ -58,4 +51,16 @@ public function parseLogRevisions(SimpleXMLElement $xml)
5851
5952 return $ revisions ;
6053 }
54+
55+ private function linkParameters ($ href )
56+ {
57+ $ args = array ();
58+ $ pos = strpos ($ href , '? ' );
59+
60+ if ($ pos !== false ) {
61+ parse_str (substr ($ href , $ pos + 1 ), $ args );
62+ }
63+
64+ return $ args ;
65+ }
6166}
Original file line number Diff line number Diff line change @@ -57,4 +57,22 @@ public function testFetchFileRevision()
5757
5858 $ this ->expectPromiseReject ($ promise );
5959 }
60+
61+ public function testFetchDirectoryRevision ()
62+ {
63+ $ this ->browser ->expects ($ this ->once ())->method ('get ' )->with ($ this ->equalTo ('http://viewvc.example.org/directory/?pathrev=1.0 ' ))->will ($ this ->returnValue ($ this ->createPromiseRejected ()));
64+
65+ $ promise = $ this ->client ->fetchDirectory ('/directory/ ' , '1.0 ' );
66+
67+ $ this ->expectPromiseReject ($ promise );
68+ }
69+
70+ public function testFetchPatch ()
71+ {
72+ $ this ->browser ->expects ($ this ->once ())->method ('get ' )->with ($ this ->equalTo ('http://viewvc.example.org/README.md?view=patch&r1=1.0&r2=1.1 ' ))->will ($ this ->returnValue ($ this ->createPromiseRejected ()));
73+
74+ $ promise = $ this ->client ->fetchPatch ('/README.md ' , '1.0 ' , '1.1 ' );
75+
76+ $ this ->expectPromiseReject ($ promise );
77+ }
6078}
You can’t perform that action at this time.
0 commit comments