1
+ <?php
2
+
3
+ namespace Github \Tests ;
4
+
5
+ use Github ;
6
+ use Github \Client ;
7
+ use Github \ResultPager ;
8
+
9
+ /**
10
+ * ResultPagerTest
11
+ *
12
+ * @author Ramon de la Fuente <ramon@future500.nl>
13
+ * @author Mitchel Verschoof <mitchel@future500.nl>
14
+ */
15
+ class ResultPagerTest extends \PHPUnit_Framework_TestCase
16
+ {
17
+ /**
18
+ * @test
19
+ *
20
+ * description fetchAll
21
+ */
22
+ public function shouldGetAllResults ()
23
+ {
24
+ $ organizationMockApi = $ this ->getApiMock ( 'Github\Api\Organization ' );
25
+ $ method = 'all ' ;
26
+ $ parameters = array ('netwerven ' );
27
+
28
+ // $paginator = new Github\ResultPaginator( $client );
29
+ // $result = $paginator->fetchAll( $organizationMockApi, 'repositories', $parameters );
30
+ }
31
+
32
+ /**
33
+ * @test
34
+ *
35
+ * description postFetch
36
+ */
37
+ public function postFetch ()
38
+ {
39
+
40
+ }
41
+
42
+ /**
43
+ * @test
44
+ *
45
+ * description fetchNext
46
+ */
47
+ public function fetchNext ()
48
+ {
49
+
50
+ }
51
+
52
+ /**
53
+ * @test
54
+ *
55
+ * description hasNext
56
+ */
57
+ public function shouldHasNext ()
58
+ {
59
+
60
+ }
61
+
62
+ /**
63
+ * @test
64
+ *
65
+ * description hasPrevious
66
+ */
67
+ public function shouldHasPrevious ()
68
+ {
69
+
70
+ }
71
+
72
+ /**
73
+ * @test
74
+ *
75
+ * description first
76
+ */
77
+ public function shouldHasFirst ()
78
+ {
79
+
80
+ }
81
+
82
+ /**
83
+ * @test
84
+ *
85
+ * description last
86
+ */
87
+ public function shouldHasLast ()
88
+ {
89
+
90
+ }
91
+
92
+ protected function getApiMock ( $ apiClass )
93
+ {
94
+ $ responseStub = $ this ->getMock ('Github\HttpClient\Message\Response ' , array ('getPagination ' ));
95
+ $ responseStub
96
+ ->expects ($ this ->any ())
97
+ ->method ('getPagination ' )
98
+ ->with (array ('test ' => 'test ' ));
99
+
100
+ var_dump ( "\n" );
101
+ var_dump ( $ responseStub );
102
+ exit ;
103
+
104
+ $ httpClient = $ this ->getMock ('Buzz\Client\ClientInterface ' , array ('setTimeout ' , 'setVerifyPeer ' , 'send ' , 'getLastResponse ' ));
105
+ $ httpClient
106
+ ->expects ($ this ->any ())
107
+ ->method ('setTimeout ' )
108
+ ->with (10 );
109
+ $ httpClient
110
+ ->expects ($ this ->any ())
111
+ ->method ('setVerifyPeer ' )
112
+ ->with (false );
113
+ $ httpClient
114
+ ->expects ($ this ->any ())
115
+ ->method ('send ' );
116
+ $ httpClient
117
+ ->expects ($ this ->any ())
118
+ ->method ('getLastResponse ' )
119
+ ->with (array (
120
+ 'first ' => 'test ' ,
121
+ 'next ' => 'test ' ,
122
+ 'previous ' => 'test ' ,
123
+ 'last ' => 'test ' ,
124
+ ));
125
+
126
+ $ mock = $ this ->getMock ('Github\HttpClient\HttpClient ' , array (), array (array (), $ httpClient ));
127
+
128
+ var_dump ( $ mock ->getLastResponse (), $ mock );
129
+
130
+ $ client = new \Github \Client ($ mock );
131
+ $ client ->setHttpClient ($ mock );
132
+
133
+ var_dump ( $ client ->getHttpClient ()->getLastResponse () );
134
+
135
+ return $ this ->getMockBuilder ( $ apiClass )
136
+ ->setMethods (array ('get ' , 'post ' , 'patch ' , 'delete ' , 'put ' ))
137
+ ->setConstructorArgs (array ($ client ))
138
+ ->getMock ();
139
+ }
140
+
141
+ }
0 commit comments