2018-03-04 16:30:16 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Tests\Integration;
|
|
|
|
|
2021-01-23 12:09:16 -08:00
|
|
|
use Carbon\CarbonImmutable;
|
|
|
|
use Pterodactyl\Tests\TestCase;
|
2018-03-04 16:30:16 -06:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2021-01-23 12:09:16 -08:00
|
|
|
use Pterodactyl\Tests\Traits\Integration\CreatesTestModels;
|
2018-03-04 16:30:16 -06:00
|
|
|
|
|
|
|
abstract class IntegrationTestCase extends TestCase
|
|
|
|
{
|
2020-06-27 10:35:02 -07:00
|
|
|
use CreatesTestModels;
|
|
|
|
|
2018-03-04 16:30:16 -06:00
|
|
|
/**
|
|
|
|
* Setup base integration test cases.
|
|
|
|
*/
|
2020-05-09 18:00:52 +02:00
|
|
|
public function setUp(): void
|
2018-03-04 16:30:16 -06: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-25 17:41:36 -05:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
2018-03-04 16:30:16 -06: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 12:09:16 -08:00
|
|
|
return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp)
|
2021-08-07 13:25:06 -07:00
|
|
|
->setTimezone('UTC')
|
2018-03-04 16:30:16 -06:00
|
|
|
->toIso8601String();
|
|
|
|
}
|
|
|
|
}
|