File tree Expand file tree Collapse file tree 2 files changed +43
-11
lines changed Expand file tree Collapse file tree 2 files changed +43
-11
lines changed Original file line number Diff line number Diff line change @@ -126,14 +126,6 @@ public function deployKeys()
126
126
return new Api \DeployKeys ($ this );
127
127
}
128
128
129
- /**
130
- * @return Api\Environments
131
- */
132
- public function environments ()
133
- {
134
- return new Api \Environments ($ this );
135
- }
136
-
137
129
/**
138
130
* @return Api\Groups
139
131
*/
@@ -291,9 +283,6 @@ public function api($name)
291
283
case 'deploy_keys ' :
292
284
return $ this ->deployKeys ();
293
285
294
- case 'environments ' :
295
- return $ this ->environments ();
296
-
297
286
case 'groups ' :
298
287
return $ this ->groups ();
299
288
Original file line number Diff line number Diff line change @@ -59,4 +59,47 @@ public function testFromArray()
59
59
$ this ->assertSame (10 , $ sUT ->iid );
60
60
$ this ->assertSame ($ client , $ sUT ->getClient ());
61
61
}
62
+
63
+ private function getIssueMock (array $ data = [])
64
+ {
65
+ $ client = $ this ->getMockBuilder (Client::class)
66
+ ->disableOriginalConstructor ()
67
+ ->getMock ();
68
+
69
+ $ project = new Project (1 , $ client );
70
+
71
+ return Issue::fromArray ($ client , $ project , $ data );
72
+ }
73
+
74
+ public function testIsClosed ()
75
+ {
76
+ $ opened_data = [
77
+ 'iid ' => 1 ,
78
+ 'state ' => 'opened ' ,
79
+ ];
80
+ $ opened_issue = $ this ->getIssueMock ($ opened_data );
81
+
82
+ $ this ->assertFalse ($ opened_issue ->isClosed ());
83
+
84
+ $ closed_data = [
85
+ 'iid ' => 1 ,
86
+ 'state ' => 'closed ' ,
87
+ ];
88
+ $ closed_issue = $ this ->getIssueMock ($ closed_data );
89
+
90
+ $ this ->assertTrue ($ closed_issue ->isClosed ());
91
+ }
92
+
93
+ public function testHasLabel ()
94
+ {
95
+ $ data = [
96
+ 'iid ' => 1 ,
97
+ 'labels ' => ['foo ' , 'bar ' ],
98
+ ];
99
+ $ issue = $ this ->getIssueMock ($ data );
100
+
101
+ $ this ->assertTrue ($ issue ->hasLabel ('foo ' ));
102
+ $ this ->assertTrue ($ issue ->hasLabel ('bar ' ));
103
+ $ this ->assertFalse ($ issue ->hasLabel ('' ));
104
+ }
62
105
}
You can’t perform that action at this time.
0 commit comments