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)
41
41
}
42
42
43
43
// 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 ' ]);
52
45
53
46
// all links containing r2 are links to previous revision
54
47
if (isset ($ args ['r2 ' ])) {
@@ -58,4 +51,16 @@ public function parseLogRevisions(SimpleXMLElement $xml)
58
51
59
52
return $ revisions ;
60
53
}
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
+ }
61
66
}
Original file line number Diff line number Diff line change @@ -57,4 +57,22 @@ public function testFetchFileRevision()
57
57
58
58
$ this ->expectPromiseReject ($ promise );
59
59
}
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
+ }
60
78
}
You can’t perform that action at this time.
0 commit comments