Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/tests/TestCase.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Tests;
4
5
use Carbon\Carbon;
6
use Carbon\CarbonImmutable;
7
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
8
9
abstract class TestCase extends BaseTestCase
10
{
11
/**
12
* Setup tests.
13
*/
14
public function setUp(): void
15
{
16
parent::setUp();
17
18
Carbon::setTestNow(Carbon::now());
19
CarbonImmutable::setTestNow(Carbon::now());
20
21
// Why, you ask? If we don't force this to false it is possible for certain exceptions
22
// to show their error message properly in the integration test output, but not actually
23
// be setup correctly to display their message in production.
24
//
25
// If we expect a message in a test, and it isn't showing up (rather, showing the generic
26
// "an error occurred" message), we can probably assume that the exception isn't one that
27
// is recognized as being user viewable.
28
config()->set('app.debug', false);
29
30
$this->setKnownUuidFactory();
31
}
32
33
/**
34
* Tear down tests.
35
*/
36
protected function tearDown(): void
37
{
38
parent::tearDown();
39
40
Carbon::setTestNow();
41
CarbonImmutable::setTestNow();
42
}
43
44
/**
45
* Handles the known UUID handling in certain unit tests. Use the "KnownUuid" trait
46
* in order to enable this ability.
47
*/
48
public function setKnownUuidFactory()
49
{
50
// do nothing
51
}
52
}
53
54