2018-03-04 23:30:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Tests\Integration;
|
|
|
|
|
2021-01-23 21:09:16 +01:00
|
|
|
use Carbon\CarbonImmutable;
|
|
|
|
use Pterodactyl\Tests\TestCase;
|
2018-03-04 23:30:16 +01:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2021-01-23 21:09:16 +01:00
|
|
|
use Pterodactyl\Tests\Traits\Integration\CreatesTestModels;
|
2018-03-04 23:30:16 +01:00
|
|
|
use Pterodactyl\Transformers\Api\Application\BaseTransformer;
|
|
|
|
|
|
|
|
abstract class IntegrationTestCase extends TestCase
|
|
|
|
{
|
2020-06-27 19:35:02 +02:00
|
|
|
use CreatesTestModels;
|
|
|
|
|
2018-03-04 23:30:16 +01:00
|
|
|
/**
|
|
|
|
* Setup base integration test cases.
|
|
|
|
*/
|
2020-05-09 18:00:52 +02:00
|
|
|
public function setUp(): void
|
2018-03-04 23:30:16 +01:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
// Disable event dispatcher to prevent eloquence from trying to
|
|
|
|
// perform validation on models going into the database. If this is
|
|
|
|
// not disabled, eloquence validation errors get swallowed and
|
|
|
|
// the tests cannot complete because nothing is put into the database.
|
|
|
|
Model::unsetEventDispatcher();
|
|
|
|
}
|
|
|
|
|
2018-03-26 00:41:36 +02:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
2018-03-04 23:30:16 +01:00
|
|
|
protected function connectionsToTransact()
|
|
|
|
{
|
|
|
|
return ['testing'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an ISO-8601 formatted timestamp to use in the API response.
|
|
|
|
*/
|
|
|
|
protected function formatTimestamp(string $timestamp): string
|
|
|
|
{
|
2021-01-23 21:09:16 +01:00
|
|
|
return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp)
|
2018-03-04 23:30:16 +01:00
|
|
|
->setTimezone(BaseTransformer::RESPONSE_TIMEZONE)
|
|
|
|
->toIso8601String();
|
|
|
|
}
|
|
|
|
}
|