| @@ 12-60 (lines=49) @@ | ||
| 9 | /**  | 
                                |
| 10 | * Class GithubIssueConverterTest.  | 
                                |
| 11 | */  | 
                                |
| 12 | class GithubIssueConverterTest extends \PHPUnit_Framework_TestCase  | 
                                |
| 13 | { | 
                                |
| 14 | /**  | 
                                |
| 15 | * @dataProvider provideConversionData  | 
                                |
| 16 | *  | 
                                |
| 17 | * @param array $issueData  | 
                                |
| 18 | */  | 
                                |
| 19 | public function testConvert(array $issueData)  | 
                                |
| 20 |     { | 
                                |
| 21 | $repo = $this->provideTestRepo();  | 
                                |
| 22 | ||
| 23 | $target = new GithubIssueConverter($repo);  | 
                                |
| 24 | ||
| 25 | self::assertInstanceOf(  | 
                                |
| 26 | 'DevBoardLib\GithubCore\Issue\GithubIssueSource',  | 
                                |
| 27 | $target->convert($issueData)  | 
                                |
| 28 | );  | 
                                |
| 29 | }  | 
                                |
| 30 | ||
| 31 | /**  | 
                                |
| 32 | * @return array  | 
                                |
| 33 | */  | 
                                |
| 34 | public function provideConversionData()  | 
                                |
| 35 |     { | 
                                |
| 36 | $testData = [];  | 
                                |
| 37 | ||
| 38 |         foreach ($this->getDataProvider()->getAllIssues() as $item) { | 
                                |
| 39 | $testData[] = [$item];  | 
                                |
| 40 | }  | 
                                |
| 41 | ||
| 42 | return $testData;  | 
                                |
| 43 | }  | 
                                |
| 44 | ||
| 45 | /**  | 
                                |
| 46 | * @return m\MockInterface  | 
                                |
| 47 | */  | 
                                |
| 48 | protected function provideTestRepo()  | 
                                |
| 49 |     { | 
                                |
| 50 |         return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); | 
                                |
| 51 | }  | 
                                |
| 52 | ||
| 53 | /**  | 
                                |
| 54 | * @return JsonSampleDataProvider  | 
                                |
| 55 | */  | 
                                |
| 56 | protected function getDataProvider()  | 
                                |
| 57 |     { | 
                                |
| 58 | return new JsonSampleDataProvider();  | 
                                |
| 59 | }  | 
                                |
| 60 | }  | 
                                |
| 61 | ||
| @@ 12-60 (lines=49) @@ | ||
| 9 | /**  | 
                                |
| 10 | * Class GithubMilestoneConverterTest.  | 
                                |
| 11 | */  | 
                                |
| 12 | class GithubMilestoneConverterTest extends \PHPUnit_Framework_TestCase  | 
                                |
| 13 | { | 
                                |
| 14 | /**  | 
                                |
| 15 | * @dataProvider provideConversionData  | 
                                |
| 16 | *  | 
                                |
| 17 | * @param array $milestoneData  | 
                                |
| 18 | */  | 
                                |
| 19 | public function testConvert(array $milestoneData)  | 
                                |
| 20 |     { | 
                                |
| 21 | $repo = $this->provideTestRepo();  | 
                                |
| 22 | ||
| 23 | $target = new GithubMilestoneConverter($repo);  | 
                                |
| 24 | ||
| 25 | self::assertInstanceOf(  | 
                                |
| 26 | 'DevBoardLib\GithubCore\Milestone\GithubMilestoneSource',  | 
                                |
| 27 | $target->convert($milestoneData)  | 
                                |
| 28 | );  | 
                                |
| 29 | }  | 
                                |
| 30 | ||
| 31 | /**  | 
                                |
| 32 | * @return array  | 
                                |
| 33 | */  | 
                                |
| 34 | public function provideConversionData()  | 
                                |
| 35 |     { | 
                                |
| 36 | $testData = [];  | 
                                |
| 37 | ||
| 38 |         foreach ($this->getDataProvider()->getAllMilestones() as $item) { | 
                                |
| 39 | $testData[] = [$item];  | 
                                |
| 40 | }  | 
                                |
| 41 | ||
| 42 | return $testData;  | 
                                |
| 43 | }  | 
                                |
| 44 | ||
| 45 | /**  | 
                                |
| 46 | * @return m\MockInterface  | 
                                |
| 47 | */  | 
                                |
| 48 | protected function provideTestRepo()  | 
                                |
| 49 |     { | 
                                |
| 50 |         return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo'); | 
                                |
| 51 | }  | 
                                |
| 52 | ||
| 53 | /**  | 
                                |
| 54 | * @return JsonSampleDataProvider  | 
                                |
| 55 | */  | 
                                |
| 56 | protected function getDataProvider()  | 
                                |
| 57 |     { | 
                                |
| 58 | return new JsonSampleDataProvider();  | 
                                |
| 59 | }  | 
                                |
| 60 | }  | 
                                |
| 61 | ||