| Total Complexity | 2 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class IssueFetcherTest extends TestCase |
||
| 13 | { |
||
| 14 | /** @var \PHPUnit_Framework_MockObject_MockObject|IssueClient */ |
||
| 15 | private $issueClient; |
||
| 16 | |||
| 17 | /** @var IssueFetcher */ |
||
| 18 | private $issueFetcher; |
||
| 19 | |||
| 20 | public function testFetchMilestoneIssues() : void |
||
| 21 | { |
||
| 22 | $response1 = new IssueClientResponse(['items' => [1]], 'https://www.google.com'); |
||
| 23 | $response2 = new IssueClientResponse(['items' => [2]], null); |
||
| 24 | |||
| 25 | $this->issueClient->expects($this->at(0)) |
||
| 26 | ->method('execute') |
||
| 27 | ->with('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed') |
||
| 28 | ->willReturn($response1); |
||
| 29 | |||
| 30 | $this->issueClient->expects($this->at(1)) |
||
| 31 | ->method('execute') |
||
| 32 | ->with('https://www.google.com') |
||
| 33 | ->willReturn($response2); |
||
| 34 | |||
| 35 | $issues = $this->issueFetcher->fetchMilestoneIssues('jwage', 'changelog-generator', '1.0'); |
||
| 36 | |||
| 37 | self::assertEquals([1, 2], $issues); |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function setUp() : void |
||
| 45 | } |
||
| 46 | } |
||
| 47 |