misc_pterodactyl-panel/tests/Integration/IntegrationTestCase.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2018-03-04 22:30:16 +00:00
<?php
namespace Pterodactyl\Tests\Integration;
use Carbon\CarbonImmutable;
use Pterodactyl\Tests\TestCase;
2018-03-04 22:30:16 +00:00
use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Tests\Traits\Integration\CreatesTestModels;
2018-03-04 22:30:16 +00:00
abstract class IntegrationTestCase extends TestCase
{
use CreatesTestModels;
2018-03-04 22:30:16 +00:00
/**
* Setup base integration test cases.
*/
public function setUp(): void
2018-03-04 22:30:16 +00: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 22:41:36 +00:00
/**
* @return array
*/
2018-03-04 22:30:16 +00:00
protected function connectionsToTransact()
{
return ['testing'];
}
/**
* Return an ISO-8601 formatted timestamp to use in the API response.
*/
protected function formatTimestamp(string $timestamp): string
{
return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp)
->setTimezone('UTC')
2018-03-04 22:30:16 +00:00
->toIso8601String();
}
}