2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
2021-01-23 20:09:16 +00:00
|
|
|
namespace Pterodactyl\Tests;
|
2015-12-06 18:58:49 +00:00
|
|
|
|
2021-01-23 20:09:16 +00:00
|
|
|
use Carbon\Carbon;
|
|
|
|
use Carbon\CarbonImmutable;
|
2017-06-14 04:25:37 +00:00
|
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
2015-12-06 18:58:49 +00:00
|
|
|
|
2017-06-14 04:25:37 +00:00
|
|
|
abstract class TestCase extends BaseTestCase
|
|
|
|
{
|
2017-07-01 20:29:49 +00:00
|
|
|
use CreatesApplication;
|
2017-06-25 00:49:09 +00:00
|
|
|
|
2017-10-08 04:29:08 +00:00
|
|
|
/**
|
|
|
|
* Setup tests.
|
|
|
|
*/
|
2020-05-09 16:00:52 +00:00
|
|
|
public function setUp(): void
|
2017-06-25 00:49:09 +00:00
|
|
|
{
|
|
|
|
parent::setUp();
|
2017-10-08 04:29:08 +00:00
|
|
|
|
2021-01-23 20:09:16 +00:00
|
|
|
Carbon::setTestNow(Carbon::now());
|
|
|
|
CarbonImmutable::setTestNow(Carbon::now());
|
|
|
|
|
2020-10-10 23:51:44 +00:00
|
|
|
// Why, you ask? If we don't force this to false it is possible for certain exceptions
|
|
|
|
// to show their error message properly in the integration test output, but not actually
|
2021-01-23 20:09:16 +00:00
|
|
|
// be setup correctly to display their message in production.
|
2020-10-10 23:51:44 +00:00
|
|
|
//
|
|
|
|
// If we expect a message in a test, and it isn't showing up (rather, showing the generic
|
|
|
|
// "an error occurred" message), we can probably assume that the exception isn't one that
|
|
|
|
// is recognized as being user viewable.
|
|
|
|
config()->set('app.debug', false);
|
|
|
|
|
2017-10-08 04:29:08 +00:00
|
|
|
$this->setKnownUuidFactory();
|
|
|
|
}
|
|
|
|
|
2018-01-14 19:30:55 +00:00
|
|
|
/**
|
|
|
|
* Tear down tests.
|
|
|
|
*/
|
2020-05-09 16:00:52 +00:00
|
|
|
protected function tearDown(): void
|
2018-01-14 19:30:55 +00:00
|
|
|
{
|
|
|
|
parent::tearDown();
|
|
|
|
|
2021-01-23 20:09:16 +00:00
|
|
|
Carbon::setTestNow();
|
|
|
|
CarbonImmutable::setTestNow();
|
2018-01-14 19:30:55 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 04:29:08 +00:00
|
|
|
/**
|
|
|
|
* Handles the known UUID handling in certain unit tests. Use the "KnownUuid" trait
|
|
|
|
* in order to enable this ability.
|
|
|
|
*/
|
|
|
|
public function setKnownUuidFactory()
|
|
|
|
{
|
|
|
|
// do nothing
|
2017-06-25 00:49:09 +00:00
|
|
|
}
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|