@@ 8-47 (lines=40) @@ | ||
5 | use Mockery as m; |
|
6 | use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider; |
|
7 | ||
8 | class GithubIssueConverterTest extends \PHPUnit_Framework_TestCase |
|
9 | { |
|
10 | /** |
|
11 | * @dataProvider provideConversionData |
|
12 | * |
|
13 | * @param array $issueData |
|
14 | */ |
|
15 | public function testConvert(array $issueData) |
|
16 | { |
|
17 | $repo = $this->provideTestRepo(); |
|
18 | ||
19 | $target = new GithubIssueConverter($repo); |
|
20 | ||
21 | self::assertInstanceOf( |
|
22 | 'DevBoardLib\GithubObjectApiFacade\Repo\Issue\GithubIssueSource', |
|
23 | $target->convert($issueData) |
|
24 | ); |
|
25 | } |
|
26 | ||
27 | public function provideConversionData() |
|
28 | { |
|
29 | $testData = []; |
|
30 | ||
31 | foreach ($this->getDataProvider()->getAllIssues() as $item) { |
|
32 | $testData[] = [$item]; |
|
33 | } |
|
34 | ||
35 | return $testData; |
|
36 | } |
|
37 | ||
38 | protected function provideTestRepo() |
|
39 | { |
|
40 | return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); |
|
41 | } |
|
42 | ||
43 | protected function getDataProvider() |
|
44 | { |
|
45 | return new SampleDataProvider(); |
|
46 | } |
|
47 | } |
|
48 |
@@ 8-47 (lines=40) @@ | ||
5 | use Mockery as m; |
|
6 | use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider; |
|
7 | ||
8 | class GithubMilestoneConverterTest extends \PHPUnit_Framework_TestCase |
|
9 | { |
|
10 | /** |
|
11 | * @dataProvider provideConversionData |
|
12 | * |
|
13 | * @param array $milestoneData |
|
14 | */ |
|
15 | public function testConvert(array $milestoneData) |
|
16 | { |
|
17 | $repo = $this->provideTestRepo(); |
|
18 | ||
19 | $target = new GithubMilestoneConverter($repo); |
|
20 | ||
21 | self::assertInstanceOf( |
|
22 | 'DevBoardLib\GithubObjectApiFacade\Repo\Milestone\GithubMilestoneSource', |
|
23 | $target->convert($milestoneData) |
|
24 | ); |
|
25 | } |
|
26 | ||
27 | public function provideConversionData() |
|
28 | { |
|
29 | $testData = []; |
|
30 | ||
31 | foreach ($this->getDataProvider()->getAllMilestones() as $item) { |
|
32 | $testData[] = [$item]; |
|
33 | } |
|
34 | ||
35 | return $testData; |
|
36 | } |
|
37 | ||
38 | protected function provideTestRepo() |
|
39 | { |
|
40 | return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); |
|
41 | } |
|
42 | ||
43 | protected function getDataProvider() |
|
44 | { |
|
45 | return new SampleDataProvider(); |
|
46 | } |
|
47 | } |
|
48 |