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