From 00fe2d6bfe3f40a47bbd7c2a7bf1de2246b7f086 Mon Sep 17 00:00:00 2001 From: VSevostyanov Date: Mon, 30 Sep 2024 15:39:18 +0200 Subject: [PATCH 1/2] HOME-1780: added roles endpoint --- Api/Endpoints/PermissionTemplates.php | 35 +++++++++++++++ Tests/Endpoints/PermissionTemplatesTest.php | 49 +++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Api/Endpoints/PermissionTemplates.php create mode 100644 Tests/Endpoints/PermissionTemplatesTest.php diff --git a/Api/Endpoints/PermissionTemplates.php b/Api/Endpoints/PermissionTemplates.php new file mode 100644 index 0000000..49edfbc --- /dev/null +++ b/Api/Endpoints/PermissionTemplates.php @@ -0,0 +1,35 @@ +request( + 'GET', + "teams/$teamId/roles", + [] + ); + } +} diff --git a/Tests/Endpoints/PermissionTemplatesTest.php b/Tests/Endpoints/PermissionTemplatesTest.php new file mode 100644 index 0000000..1261220 --- /dev/null +++ b/Tests/Endpoints/PermissionTemplatesTest.php @@ -0,0 +1,49 @@ +mockedContributors = $this->createEndpointMock(PermissionTemplates::class); + } + + protected function tearDown(): void + { + $this->mockedContributors = null; + } + + public function testEndpointClass(): void + { + self::assertInstanceOf(Endpoint::class, $this->mockedContributors); + self::assertInstanceOf(EndpointInterface::class, $this->mockedContributors); + } + + public function testList(): void + { + $teamId = '1'; + + self::assertEquals( + [ + 'requestType' => 'GET', + 'uri' => "teams/$teamId/roles", + 'queryParams' => [], + 'body' => [], + ], + $this->mockedContributors->list($teamId)->getContent() + ); + } +} \ No newline at end of file From 4218687ac32fbb4f03577a63c57b33759f7aeb0c Mon Sep 17 00:00:00 2001 From: VSevostyanov Date: Tue, 1 Oct 2024 15:39:25 +0200 Subject: [PATCH 2/2] HOME-1780: fixed test naming --- Tests/Endpoints/PermissionTemplatesTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/Endpoints/PermissionTemplatesTest.php b/Tests/Endpoints/PermissionTemplatesTest.php index 1261220..a2d9970 100644 --- a/Tests/Endpoints/PermissionTemplatesTest.php +++ b/Tests/Endpoints/PermissionTemplatesTest.php @@ -18,18 +18,18 @@ final class PermissionTemplatesTest extends TestCase protected function setUp(): void { - $this->mockedContributors = $this->createEndpointMock(PermissionTemplates::class); + $this->mockedPermisionTemplates = $this->createEndpointMock(PermissionTemplates::class); } protected function tearDown(): void { - $this->mockedContributors = null; + $this->mockedPermisionTemplates = null; } public function testEndpointClass(): void { - self::assertInstanceOf(Endpoint::class, $this->mockedContributors); - self::assertInstanceOf(EndpointInterface::class, $this->mockedContributors); + self::assertInstanceOf(Endpoint::class, $this->mockedPermisionTemplates); + self::assertInstanceOf(EndpointInterface::class, $this->mockedPermisionTemplates); } public function testList(): void @@ -43,7 +43,7 @@ public function testList(): void 'queryParams' => [], 'body' => [], ], - $this->mockedContributors->list($teamId)->getContent() + $this->mockedPermisionTemplates->list($teamId)->getContent() ); } } \ No newline at end of file