mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
29 lines
797 B
PHP
29 lines
797 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Tests\Support\Fakes;
|
|
|
|
use GuzzleHttp\Promise\PromiseInterface;
|
|
use Illuminate\Http\Client\Request;
|
|
use PHPUnit\Framework\Assert;
|
|
|
|
class FakeDaemonTransfer extends FakeDaemonHttpClient
|
|
{
|
|
public function assertNotified(): void
|
|
{
|
|
Assert::assertNotEmpty($this->callsFor('notify'), 'Expected daemon transfer notify to have been called.');
|
|
}
|
|
|
|
protected function responseFor(Request $request): ?PromiseInterface
|
|
{
|
|
if ($request->method() !== 'POST' || ! preg_match('#^/api/servers/([^/]+)/transfer$#', parse_url($request->url(), PHP_URL_PATH))) {
|
|
return null;
|
|
}
|
|
|
|
$this->record('notify', ['url' => $request['url'], 'token' => $request['token']]);
|
|
|
|
return $this->reply();
|
|
}
|
|
}
|