-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX SIO-3769 update fqdns on hostname change
- Loading branch information
Mikhail Korsakov
committed
Oct 25, 2021
1 parent
51b16a4
commit 31e03d7
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
// Copyright 2021. Plesk International GmbH. | ||
|
||
namespace Tests\lib\SolusAPI\Resources; | ||
|
||
use Mockery; | ||
use PHPUnit\Framework\TestCase; | ||
use WHMCS\Module\Server\SolusIoVps\SolusAPI\Resources\ServerResource; | ||
|
||
/** | ||
* @runTestsInSeparateProcesses | ||
*/ | ||
class ServerResourceTest extends TestCase | ||
{ | ||
public function testChangeHostname(): void | ||
{ | ||
$id = 1; | ||
$hostname = 'test.domain.tld'; | ||
|
||
$serverResource = Mockery::mock(ServerResource::class) | ||
->shouldAllowMockingProtectedMethods() | ||
->makePartial(); | ||
|
||
$serverResource->shouldReceive('processResponse')->andReturn([]); | ||
$serverResource->shouldReceive('getConnector->patch')->with( | ||
"servers/{$id}", | ||
[ | ||
'json' => [ | ||
'name' => $hostname, | ||
'fqdns' => [ $hostname ], | ||
], | ||
], | ||
); | ||
|
||
$this->addToAssertionCount( | ||
Mockery::getContainer()->mockery_getExpectationCount() | ||
); | ||
|
||
$serverResource->changeHostname($id, $hostname); | ||
} | ||
} |