Skip to content

Commit c522085

Browse files
resolve merge conflicts
1 parent 060f9f2 commit c522085

File tree

2 files changed

+109
-92
lines changed

2 files changed

+109
-92
lines changed

lib/Gitlab/Api/IssueBoards.php

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,47 @@ public function all($project_id = null, array $parameters = [])
1717
return $this->get($path, $resolver->resolve($parameters));
1818
}
1919

20+
/**
21+
* @param int $project_id
22+
* @param int $board_id
23+
* @return mixed
24+
*/
25+
public function show($project_id, $board_id)
26+
{
27+
return $this->get($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id)));
28+
}
29+
30+
/**
31+
* @param int $project_id
32+
* @param array $params
33+
* @return mixed
34+
*/
35+
public function create($project_id, array $params)
36+
{
37+
return $this->post($this->getProjectPath($project_id, 'boards'), $params);
38+
}
39+
40+
/**
41+
* @param int $project_id
42+
* @param int $board_id
43+
* @param array $params
44+
* @return mixed
45+
*/
46+
public function update($project_id, $board_id, array $params)
47+
{
48+
return $this->put($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id)), $params);
49+
}
50+
51+
/**
52+
* @param int $project_id
53+
* @param int $board_id
54+
* @return mixed
55+
*/
56+
public function remove($project_id, $board_id)
57+
{
58+
return $this->delete($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id)));
59+
}
60+
2061
/**
2162
* @param int $project_id
2263
* @param int $board_id
@@ -27,7 +68,6 @@ public function allLists($project_id, $board_id)
2768
return $this->get($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id).'/lists'));
2869
}
2970

30-
3171
/**
3272
* @param int $project_id
3373
* @param int $board_id

test/Gitlab/Tests/Api/IssueBoardsTest.php

Lines changed: 68 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -21,97 +21,74 @@ public function shouldGetAllBoards()
2121

2222
$this->assertEquals($expectedArray, $api->all());
2323
}
24-
//
25-
// /**
26-
// * @test
27-
// */
28-
// public function shouldGetProjectIssuesWithPagination()
29-
// {
30-
// $expectedArray = array(
31-
// array('id' => 1, 'title' => 'An issue'),
32-
// array('id' => 2, 'title' => 'Another issue'),
33-
// );
34-
//
35-
// $api = $this->getApiMock();
36-
// $api->expects($this->once())
37-
// ->method('get')
38-
// ->with('projects/1/issues', array('page' => 2, 'per_page' => 5))
39-
// ->will($this->returnValue($expectedArray))
40-
// ;
41-
//
42-
// $this->assertEquals($expectedArray, $api->all(1, 2, 5));
43-
// }
44-
//
45-
// /**
46-
// * @test
47-
// */
48-
// public function shouldGetProjectIssuesWithParams()
49-
// {
50-
// $expectedArray = array(
51-
// array('id' => 1, 'title' => 'An issue'),
52-
// array('id' => 2, 'title' => 'Another issue'),
53-
// );
54-
//
55-
// $api = $this->getApiMock();
56-
// $api->expects($this->once())
57-
// ->method('get')
58-
// ->with('projects/1/issues', array('page' => 2, 'per_page' => 5, 'order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'open'))
59-
// ->will($this->returnValue($expectedArray))
60-
// ;
61-
//
62-
// $this->assertEquals($expectedArray, $api->all(1, 2, 5, array('order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'open')));
63-
// }
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-
// }
24+
25+
/**
26+
* @test
27+
*/
28+
public function shouldShowIssueBoard()
29+
{
30+
$expectedArray = array('id' => 2, 'name' => 'Another issue board');
31+
32+
$api = $this->getApiMock();
33+
$api->expects($this->once())
34+
->method('get')
35+
->with('projects/1/boards/2')
36+
->will($this->returnValue($expectedArray))
37+
;
38+
39+
$this->assertEquals($expectedArray, $api->show(1, 2));
40+
}
41+
42+
/**
43+
* @test
44+
*/
45+
public function shouldCreateIssueBoard()
46+
{
47+
$expectedArray = array('id' => 3, 'name' => 'A new issue board');
48+
49+
$api = $this->getApiMock();
50+
$api->expects($this->once())
51+
->method('post')
52+
->with('projects/1/boards', array('name' => 'A new issue board'))
53+
->will($this->returnValue($expectedArray))
54+
;
55+
56+
$this->assertEquals($expectedArray, $api->create(1, array('name' => 'A new issue board')));
57+
}
58+
59+
/**
60+
* @test
61+
*/
62+
public function shouldUpdateIssueBoard()
63+
{
64+
$expectedArray = array('id' => 2, 'name' => 'A renamed issue board');
65+
66+
$api = $this->getApiMock();
67+
$api->expects($this->once())
68+
->method('put')
69+
->with('projects/1/boards/2', array('name' => 'A renamed issue board', 'labels' => 'foo'))
70+
->will($this->returnValue($expectedArray))
71+
;
72+
73+
$this->assertEquals($expectedArray, $api->update(1, 2, array('name' => 'A renamed issue board', 'labels' => 'foo')));
74+
}
75+
76+
/**
77+
* @test
78+
*/
79+
public function shouldRemoveIssueBoard()
80+
{
81+
$expectedBool = true;
82+
83+
$api = $this->getApiMock();
84+
$api->expects($this->once())
85+
->method('delete')
86+
->with('projects/1/boards/2')
87+
->will($this->returnValue($expectedBool))
88+
;
89+
90+
$this->assertEquals($expectedBool, $api->remove(1, 2));
91+
}
11592

11693
/**
11794
* @test

0 commit comments

Comments
 (0)