Skip to content

Commit a838d2d

Browse files
sidneymarieannem1guelpf
authored andcommitted
add phpunit tests for issue boards crud methods
1 parent 7a47383 commit a838d2d

File tree

1 file changed

+69
-52
lines changed

1 file changed

+69
-52
lines changed

test/Gitlab/Tests/Api/IssueBoardsTest.php

Lines changed: 69 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -61,58 +61,75 @@ public function shouldGetAllBoards()
6161
//
6262
// $this->assertEquals($expectedArray, $api->all(1, 2, 5, array('order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'open')));
6363
// }
64-
//
65-
// /**
66-
// * @test
67-
// */
68-
// public function shouldShowIssue()
69-
// {
70-
// $expectedArray = array('id' => 2, 'title' => 'Another issue');
71-
//
72-
// $api = $this->getApiMock();
73-
// $api->expects($this->once())
74-
// ->method('get')
75-
// ->with('projects/1/issues?iid=2')
76-
// ->will($this->returnValue($expectedArray))
77-
// ;
78-
//
79-
// $this->assertEquals($expectedArray, $api->show(1, 2));
80-
// }
81-
//
82-
// /**
83-
// * @test
84-
// */
85-
// public function shouldCreateIssue()
86-
// {
87-
// $expectedArray = array('id' => 3, 'title' => 'A new issue');
88-
//
89-
// $api = $this->getApiMock();
90-
// $api->expects($this->once())
91-
// ->method('post')
92-
// ->with('projects/1/issues', array('title' => 'A new issue', 'labels' => 'foo,bar'))
93-
// ->will($this->returnValue($expectedArray))
94-
// ;
95-
//
96-
// $this->assertEquals($expectedArray, $api->create(1, array('title' => 'A new issue', 'labels' => 'foo,bar')));
97-
// }
98-
//
99-
// /**
100-
// * @test
101-
// */
102-
// public function shouldUpdateIssue()
103-
// {
104-
// $expectedArray = array('id' => 2, 'title' => 'A renamed issue');
105-
//
106-
// $api = $this->getApiMock();
107-
// $api->expects($this->once())
108-
// ->method('put')
109-
// ->with('projects/1/issues/2', array('title' => 'A renamed issue', 'labels' => 'foo'))
110-
// ->will($this->returnValue($expectedArray))
111-
// ;
112-
//
113-
// $this->assertEquals($expectedArray, $api->update(1, 2, array('title' => 'A renamed issue', 'labels' => 'foo')));
114-
// }
115-
//
64+
65+
/**
66+
* @test
67+
*/
68+
public function shouldShowIssueBoard()
69+
{
70+
$expectedArray = array('id' => 2, 'name' => 'Another issue board');
71+
72+
$api = $this->getApiMock();
73+
$api->expects($this->once())
74+
->method('get')
75+
->with('projects/1/boards/2')
76+
->will($this->returnValue($expectedArray))
77+
;
78+
79+
$this->assertEquals($expectedArray, $api->show(1, 2));
80+
}
81+
82+
/**
83+
* @test
84+
*/
85+
public function shouldCreateIssueBoard()
86+
{
87+
$expectedArray = array('id' => 3, 'name' => 'A new issue board');
88+
89+
$api = $this->getApiMock();
90+
$api->expects($this->once())
91+
->method('post')
92+
->with('projects/1/boards', array('name' => 'A new issue board'))
93+
->will($this->returnValue($expectedArray))
94+
;
95+
96+
$this->assertEquals($expectedArray, $api->create(1, array('name' => 'A new issue board')));
97+
}
98+
99+
/**
100+
* @test
101+
*/
102+
public function shouldUpdateIssueBoard()
103+
{
104+
$expectedArray = array('id' => 2, 'name' => 'A renamed issue board');
105+
106+
$api = $this->getApiMock();
107+
$api->expects($this->once())
108+
->method('put')
109+
->with('projects/1/boards/2', array('name' => 'A renamed issue board', 'labels' => 'foo'))
110+
->will($this->returnValue($expectedArray))
111+
;
112+
113+
$this->assertEquals($expectedArray, $api->update(1, 2, array('name' => 'A renamed issue board', 'labels' => 'foo')));
114+
}
115+
116+
/**
117+
* @test
118+
*/
119+
public function shouldRemoveIssueBoard()
120+
{
121+
$expectedBool = true;
122+
123+
$api = $this->getApiMock();
124+
$api->expects($this->once())
125+
->method('delete')
126+
->with('projects/1/boards/2')
127+
->will($this->returnValue($expectedBool))
128+
;
129+
130+
$this->assertEquals($expectedBool, $api->remove(1, 2));
131+
}
132+
116133
// /**
117134
// * @test
118135
// */

0 commit comments

Comments
 (0)