From bcb35cf1bc6878a6d136d56cf35fa785abcc96a6 Mon Sep 17 00:00:00 2001 From: Rapolas Gruzdys Date: Fri, 6 Oct 2023 11:35:19 +0300 Subject: [PATCH] Make all arguments nullable for modifyOrganization method in Organizations resource (#34) - The endpoint allows any value to be null - The changes better reflect the endpoint's functionality - Modified the test case to cover all or no arguments --- src/Resources/Organizations.php | 12 +++++------ tests/Resources/OrganizationsTest.php | 30 ++++++++++++++++++--------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/Resources/Organizations.php b/src/Resources/Organizations.php index 1672bda..f34e03c 100644 --- a/src/Resources/Organizations.php +++ b/src/Resources/Organizations.php @@ -85,12 +85,12 @@ public function createSubOrganization( } public function modifyOrganization( - string $name, - string $contactEmail, - bool $twoFactorAuthenticationRequired, - string $statsEndpoint, - int $maxUsers, - int $maxRouters, + string $name = null, + string $contactEmail = null, + bool $twoFactorAuthenticationRequired = null, + string $statsEndpoint = null, + int $maxUsers = null, + int $maxRouters = null, string $address = null, string $website = null, string $contactName = null, diff --git a/tests/Resources/OrganizationsTest.php b/tests/Resources/OrganizationsTest.php index 909f80f..0b039ab 100644 --- a/tests/Resources/OrganizationsTest.php +++ b/tests/Resources/OrganizationsTest.php @@ -86,7 +86,7 @@ expect($result)->toBeInstanceOf(Organization::class); }); -it('modifies the organization', function () { +it('modifies the organization', function (array $arguments) { $request = Http::fake([ 'organizations' => Http::response(mockJsonEndpoint('organizations-modify-organization')), ])->asJson(); @@ -97,14 +97,24 @@ $this->createStub(MemberFactory::class), ); - $result = $resource->modifyOrganization( - 'name', - 'test@example.com', - true, - 'europe', - 100, - 100 - ); + $result = $resource->modifyOrganization(...$arguments); expect($result)->toBeInstanceOf(Organization::class); -}); +})->with([ + [ + [ + 'name', + 'test@example.com', + true, + 'europe', + 100, + 100, + 'Fake str. 123', + 'example.com', + 'Contact Name', + '+12345567890', + 'parent_profile_pk', + ], + [], + ], +]);