@@ 12-66 (lines=55) @@ | ||
9 | /** |
|
10 | * Class GithubBranchConverterTest. |
|
11 | */ |
|
12 | class GithubBranchConverterTest extends \PHPUnit_Framework_TestCase |
|
13 | { |
|
14 | /** |
|
15 | * @dataProvider provideConversionData |
|
16 | * |
|
17 | * @param $repoData |
|
18 | */ |
|
19 | public function testConvert($repoData) |
|
20 | { |
|
21 | $repo = $this->provideTestRepo(); |
|
22 | ||
23 | $target = new GithubBranchConverter($repo); |
|
24 | ||
25 | self::assertInstanceOf( |
|
26 | 'DevBoardLib\GithubCore\Branch\GithubBranchSource', |
|
27 | $target->convert($repoData) |
|
28 | ); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return array |
|
33 | */ |
|
34 | public function provideConversionData() |
|
35 | { |
|
36 | $testData = []; |
|
37 | ||
38 | foreach ($this->getDataProvider()->getAllBranches() as $item) { |
|
39 | $testData[] = [$item]; |
|
40 | } |
|
41 | ||
42 | return $testData; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return m\MockInterface |
|
47 | */ |
|
48 | protected function provideTestRepo() |
|
49 | { |
|
50 | $repo = m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); |
|
51 | $repoId = m::mock('DevBoardLib\GithubCore\Repo\GithubRepoId'); |
|
52 | ||
53 | $repo->shouldReceive('getId')->andReturn($repoId); |
|
54 | $repoId->shouldReceive('getId')->andReturn(123); |
|
55 | ||
56 | return $repo; |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * @return SampleDataProvider |
|
61 | */ |
|
62 | protected function getDataProvider() |
|
63 | { |
|
64 | return new SampleDataProvider(); |
|
65 | } |
|
66 | } |
|
67 |
@@ 12-66 (lines=55) @@ | ||
9 | /** |
|
10 | * Class GithubPullRequestConverterTest. |
|
11 | */ |
|
12 | class GithubPullRequestConverterTest extends \PHPUnit_Framework_TestCase |
|
13 | { |
|
14 | /** |
|
15 | * @dataProvider provideConversionData |
|
16 | * |
|
17 | * @param $repoData |
|
18 | */ |
|
19 | public function testConvert($repoData) |
|
20 | { |
|
21 | $repo = $this->provideTestRepo(); |
|
22 | ||
23 | $target = new GithubPullRequestConverter($repo); |
|
24 | ||
25 | self::assertInstanceOf( |
|
26 | 'DevBoardLib\GithubCore\PullRequest\GithubPullRequestSource', |
|
27 | $target->convert($repoData) |
|
28 | ); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return array |
|
33 | */ |
|
34 | public function provideConversionData() |
|
35 | { |
|
36 | $testData = []; |
|
37 | ||
38 | foreach ($this->getDataProvider()->getAllPullRequests() as $item) { |
|
39 | $testData[] = [$item]; |
|
40 | } |
|
41 | ||
42 | return $testData; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return m\MockInterface |
|
47 | */ |
|
48 | protected function provideTestRepo() |
|
49 | { |
|
50 | $repo = m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); |
|
51 | $repoId = m::mock('DevBoardLib\GithubCore\Repo\GithubRepoId'); |
|
52 | ||
53 | $repo->shouldReceive('getId')->andReturn($repoId); |
|
54 | $repoId->shouldReceive('getId')->andReturn(123); |
|
55 | ||
56 | return $repo; |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * @return SampleDataProvider |
|
61 | */ |
|
62 | protected function getDataProvider() |
|
63 | { |
|
64 | return new SampleDataProvider(); |
|
65 | } |
|
66 | } |
|
67 |
@@ 12-66 (lines=55) @@ | ||
9 | /** |
|
10 | * Class GithubTagConverterTest. |
|
11 | */ |
|
12 | class GithubTagConverterTest extends \PHPUnit_Framework_TestCase |
|
13 | { |
|
14 | /** |
|
15 | * @dataProvider provideConversionData |
|
16 | * |
|
17 | * @param $repoData |
|
18 | */ |
|
19 | public function testConvert($repoData) |
|
20 | { |
|
21 | $repo = $this->provideTestRepo(); |
|
22 | ||
23 | $target = new GithubTagConverter($repo); |
|
24 | ||
25 | self::assertInstanceOf( |
|
26 | 'DevBoardLib\GithubCore\Tag\GithubTagSource', |
|
27 | $target->convert($repoData) |
|
28 | ); |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return array |
|
33 | */ |
|
34 | public function provideConversionData() |
|
35 | { |
|
36 | $testData = []; |
|
37 | ||
38 | foreach ($this->getDataProvider()->getAllTagNames() as $item) { |
|
39 | $testData[] = [$item]; |
|
40 | } |
|
41 | ||
42 | return $testData; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return m\MockInterface |
|
47 | */ |
|
48 | protected function provideTestRepo() |
|
49 | { |
|
50 | $repo = m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); |
|
51 | $repoId = m::mock('DevBoardLib\GithubCore\Repo\GithubRepoId'); |
|
52 | ||
53 | $repo->shouldReceive('getId')->andReturn($repoId); |
|
54 | $repoId->shouldReceive('getId')->andReturn(123); |
|
55 | ||
56 | return $repo; |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * @return SampleDataProvider |
|
61 | */ |
|
62 | protected function getDataProvider() |
|
63 | { |
|
64 | return new SampleDataProvider(); |
|
65 | } |
|
66 | } |
|
67 |