Skip to content

Commit 8693991

Browse files
webmaster777m1guelpf
authored andcommitted
very basic test case added for Environments::show()
1 parent 15c85ca commit 8693991

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

test/Gitlab/Tests/Api/EnvironmentsTest.php

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,89 @@ public function shouldGetAllEnvironments()
3030
$this->assertEquals($expectedArray, $api->all(1));
3131
}
3232

33+
/**
34+
* @test
35+
*/
36+
public function shouldGetSingleEnvironment()
37+
{
38+
$expected = array(
39+
'id' => 1,
40+
'name' => 'review/fix-foo',
41+
'slug' => 'review-fix-foo-dfjre3',
42+
'external_url' => 'https://review-fix-foo-dfjre3.example.gitlab.com',
43+
'latest_deployment' => array(
44+
'created_at' => '2016-08-11T07:36:40.222Z',
45+
'deployable' =>
46+
array(
47+
'commit' =>
48+
array(
49+
'author_email' => '[email protected]',
50+
'author_name' => 'Administrator',
51+
'created_at' => '2016-08-11T09:36:01.000+02:00',
52+
'id' => '99d03678b90d914dbb1b109132516d71a4a03ea8',
53+
'message' => 'Merge branch \'new-title\' into \'master\'
54+
55+
Update README
56+
57+
58+
59+
See merge request !1',
60+
'short_id' => '99d03678',
61+
'title' => 'Merge branch \'new-title\' into \'master\'
62+
',
63+
),
64+
'coverage' => null,
65+
'created_at' => '2016-08-11T07:36:27.357Z',
66+
'finished_at' => '2016-08-11T07:36:39.851Z',
67+
'id' => 657,
68+
'name' => 'deploy',
69+
'ref' => 'master',
70+
'runner' => null,
71+
'stage' => 'deploy',
72+
'started_at' => null,
73+
'status' => 'success',
74+
'tag' => false,
75+
'user' =>
76+
array(
77+
'avatar_url' => 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
78+
'bio' => null,
79+
'created_at' => '2016-08-11T07:09:20.351Z',
80+
'id' => 1,
81+
'linkedin' => '',
82+
'location' => null,
83+
'name' => 'Administrator',
84+
'skype' => '',
85+
'state' => 'active',
86+
'twitter' => '',
87+
'username' => 'root',
88+
'web_url' => 'http://localhost:3000/root',
89+
'website_url' => '',
90+
),
91+
),
92+
'id' => 41,
93+
'iid' => 1,
94+
'ref' => 'master',
95+
'sha' => '99d03678b90d914dbb1b109132516d71a4a03ea8',
96+
'user' =>
97+
array(
98+
'avatar_url' => 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
99+
'id' => 1,
100+
'name' => 'Administrator',
101+
'state' => 'active',
102+
'username' => 'root',
103+
'web_url' => 'http://localhost:3000/root',
104+
),
105+
)
106+
);
107+
108+
$api = $this->getApiMock();
109+
$api->expects($this->once())
110+
->method('get')
111+
->with('projects/1/environments/1')
112+
->will($this->returnValue($expected));
113+
$this->assertEquals($expected, $api->show(1, 1));
114+
}
115+
33116
/**
34117
* @test
35118
*/

0 commit comments

Comments
 (0)