Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/tests/TestCase.php
10260 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
$now = Carbon::now()->startOfSecond();
19
20
Carbon::setTestNow($now);
21
CarbonImmutable::setTestNow($now);
22
23
// Why, you ask? If we don't force this to false it is possible for certain exceptions
24
// to show their error message properly in the integration test output, but not actually
25
// be setup correctly to display their message in production.
26
//
27
// If we expect a message in a test, and it isn't showing up (rather, showing the generic
28
// "an error occurred" message), we can probably assume that the exception isn't one that
29
// is recognized as being user viewable.
30
config()->set('app.debug', false);
31
32
$this->setKnownUuidFactory();
33
}
34
35
/**
36
* Tear down tests.
37
*/
38
protected function tearDown(): void
39
{
40
parent::tearDown();
41
42
Carbon::setTestNow();
43
CarbonImmutable::setTestNow();
44
}
45
46
/**
47
* Handles the known UUID handling in certain unit tests. Use the "KnownUuid" trait
48
* in order to enable this ability.
49
*/
50
public function setKnownUuidFactory()
51
{
52
// do nothing
53
}
54
}
55
56