|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Github\Tests\Api\Copilot; |
| 4 | + |
| 5 | +use Github\Api\Copilot\Usage; |
| 6 | +use Github\Tests\Api\TestCase; |
| 7 | + |
| 8 | +class UsageTest extends TestCase |
| 9 | +{ |
| 10 | + /** |
| 11 | + * @test |
| 12 | + */ |
| 13 | + public function shouldGetOrgUsageSummary(): void |
| 14 | + { |
| 15 | + $expectedValue = ['usage1', 'usage2']; |
| 16 | + |
| 17 | + $api = $this->getApiMock(); |
| 18 | + $api->expects($this->once()) |
| 19 | + ->method('get') |
| 20 | + ->with('/orgs/KnpLabs/copilot/usage', []) |
| 21 | + ->will($this->returnValue($expectedValue)); |
| 22 | + |
| 23 | + $this->assertEquals($expectedValue, $api->orgUsageSummary('KnpLabs')); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @test |
| 28 | + */ |
| 29 | + public function shouldGetOrgTeamUsageSummary(): void |
| 30 | + { |
| 31 | + $expectedValue = ['usage1', 'usage2']; |
| 32 | + |
| 33 | + $api = $this->getApiMock(); |
| 34 | + $api->expects($this->once()) |
| 35 | + ->method('get') |
| 36 | + ->with('/orgs/KnpLabs/teams/php-github-api/copilot/usage', []) |
| 37 | + ->will($this->returnValue($expectedValue)); |
| 38 | + |
| 39 | + $this->assertEquals($expectedValue, $api->orgTeamUsageSummary('KnpLabs', 'php-github-api')); |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * @test |
| 44 | + */ |
| 45 | + public function shouldGetEnterpriseUsageSummary(): void |
| 46 | + { |
| 47 | + $expectedValue = ['usage1', 'usage2']; |
| 48 | + |
| 49 | + $api = $this->getApiMock(); |
| 50 | + $api->expects($this->once()) |
| 51 | + ->method('get') |
| 52 | + ->with('/enterprises/KnpLabs/copilot/usage', []) |
| 53 | + ->will($this->returnValue($expectedValue)); |
| 54 | + |
| 55 | + $this->assertEquals($expectedValue, $api->enterpriseUsageSummary('KnpLabs')); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * @test |
| 60 | + */ |
| 61 | + public function shouldGetEnterpriseTeamUsageSummary(): void |
| 62 | + { |
| 63 | + $expectedValue = ['usage1', 'usage2']; |
| 64 | + |
| 65 | + $api = $this->getApiMock(); |
| 66 | + $api->expects($this->once()) |
| 67 | + ->method('get') |
| 68 | + ->with('/enterprises/KnpLabs/teams/php-github-api/copilot/usage', []) |
| 69 | + ->will($this->returnValue($expectedValue)); |
| 70 | + |
| 71 | + $this->assertEquals($expectedValue, $api->enterpriseTeamUsageSummary('KnpLabs', 'php-github-api')); |
| 72 | + } |
| 73 | + |
| 74 | + protected function getApiClass(): string |
| 75 | + { |
| 76 | + return Usage::class; |
| 77 | + } |
| 78 | +} |
0 commit comments