Use a standardized transformer base; replace all client transformers to call that base

This commit is contained in:
Dane Everitt 2021-08-07 13:06:45 -07:00
parent 2203a4d87e
commit cf500a1a54
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
25 changed files with 255 additions and 379 deletions

View file

@ -10,7 +10,6 @@ use Pterodactyl\Tests\Integration\IntegrationTestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Pterodactyl\Tests\Traits\Integration\CreatesTestModels;
use Pterodactyl\Transformers\Api\Application\BaseTransformer;
use Pterodactyl\Transformers\Api\Client\BaseClientTransformer;
use Pterodactyl\Tests\Traits\Http\IntegrationJsonRequestAssertions;
abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
@ -137,10 +136,8 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
{
/** @var \Pterodactyl\Transformers\Api\Application\BaseTransformer $transformer */
$transformer = $this->app->make($abstract);
$transformer->setKey($this->getApiKey());
Assert::assertInstanceOf(BaseTransformer::class, $transformer);
Assert::assertNotInstanceOf(BaseClientTransformer::class, $transformer);
return $transformer;
}

View file

@ -19,7 +19,6 @@ use Pterodactyl\Models\Allocation;
use Pterodactyl\Models\DatabaseHost;
use Pterodactyl\Tests\Integration\TestResponse;
use Pterodactyl\Tests\Integration\IntegrationTestCase;
use Pterodactyl\Transformers\Api\Client\BaseClientTransformer;
abstract class ClientApiIntegrationTestCase extends IntegrationTestCase
{
@ -124,7 +123,6 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase
$transformer = sprintf('\\Pterodactyl\\Transformers\\Api\\Client\\%sTransformer', $reflect->getShortName());
$transformer = new $transformer();
$this->assertInstanceOf(BaseClientTransformer::class, $transformer);
$this->assertSame(
$transformer->transform($model),