6
6
7
7
class LabelsTest extends TestCase
8
8
{
9
+
10
+ /**
11
+ * @test
12
+ */
13
+ public function shouldGetProjectLabels ()
14
+ {
15
+ $ expectedValue = array (
16
+ array ('name ' => 'l3l0repo ' ),
17
+ array ('name ' => 'other ' ),
18
+ );
19
+
20
+ $ api = $ this ->getApiMock ();
21
+ $ api ->expects ($ this ->once ())
22
+ ->method ('get ' )
23
+ ->with ('repos/KnpLabs/php-github-api/labels ' , array ())
24
+ ->will ($ this ->returnValue ($ expectedValue ));
25
+
26
+ $ this ->assertEquals ($ expectedValue , $ api ->all ('KnpLabs ' , 'php-github-api ' ));
27
+ }
28
+
9
29
/**
10
30
* @test
11
31
*/
@@ -22,6 +42,40 @@ public function shouldGetAllIssueLabels()
22
42
$ this ->assertEquals ($ expectedValue , $ api ->all ('KnpLabs ' , 'php-github-api ' , '123 ' ));
23
43
}
24
44
45
+ /**
46
+ * @test
47
+ */
48
+ public function shouldCreateLabel ()
49
+ {
50
+ $ expectedValue = array (array ('name ' => 'label ' , 'color ' => 'FFFFFF ' ));
51
+ $ data = array ('name ' => 'label ' );
52
+
53
+ $ api = $ this ->getApiMock ();
54
+ $ api ->expects ($ this ->once ())
55
+ ->method ('post ' )
56
+ ->with ('repos/KnpLabs/php-github-api/labels ' , $ data + array ('color ' => 'FFFFFF ' ))
57
+ ->will ($ this ->returnValue ($ expectedValue ));
58
+
59
+ $ this ->assertEquals ($ expectedValue , $ api ->create ('KnpLabs ' , 'php-github-api ' , $ data ));
60
+ }
61
+
62
+ /**
63
+ * @test
64
+ */
65
+ public function shouldCreateLabelWithColor ()
66
+ {
67
+ $ expectedValue = array (array ('name ' => 'label ' , 'color ' => '111111 ' ));
68
+ $ data = array ('name ' => 'label ' , 'color ' => '111111 ' );
69
+
70
+ $ api = $ this ->getApiMock ();
71
+ $ api ->expects ($ this ->once ())
72
+ ->method ('post ' )
73
+ ->with ('repos/KnpLabs/php-github-api/labels ' , $ data )
74
+ ->will ($ this ->returnValue ($ expectedValue ));
75
+
76
+ $ this ->assertEquals ($ expectedValue , $ api ->create ('KnpLabs ' , 'php-github-api ' , $ data ));
77
+ }
78
+
25
79
/**
26
80
* @test
27
81
*/
0 commit comments