Skip to content

Commit

Permalink
Make all arguments nullable for modifyOrganization method in Organiza…
Browse files Browse the repository at this point in the history
…tions 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
  • Loading branch information
rapkis authored Oct 6, 2023
1 parent 2397bce commit bcb35cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/Resources/Organizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
30 changes: 20 additions & 10 deletions tests/Resources/OrganizationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -97,14 +97,24 @@
$this->createStub(MemberFactory::class),
);

$result = $resource->modifyOrganization(
'name',
'[email protected]',
true,
'europe',
100,
100
);
$result = $resource->modifyOrganization(...$arguments);

expect($result)->toBeInstanceOf(Organization::class);
});
})->with([
[
[
'name',
'[email protected]',
true,
'europe',
100,
100,
'Fake str. 123',
'example.com',
'Contact Name',
'+12345567890',
'parent_profile_pk',
],
[],
],
]);

0 comments on commit bcb35cf

Please sign in to comment.