66
77class LabelsTest extends TestCase
88{
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+
929 /**
1030 * @test
1131 */
@@ -22,6 +42,40 @@ public function shouldGetAllIssueLabels()
2242 $ this ->assertEquals ($ expectedValue , $ api ->all ('KnpLabs ' , 'php-github-api ' , '123 ' ));
2343 }
2444
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+
2579 /**
2680 * @test
2781 */
0 commit comments