-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTestCase.php
54 lines (44 loc) · 1.41 KB
/
TestCase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Pterodactyl\Tests;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Setup tests.
*/
protected function setUp(): void
{
parent::setUp();
Carbon::setTestNow(Carbon::now());
CarbonImmutable::setTestNow(Carbon::now());
// 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
// be setup correctly to display their message in production.
//
// 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);
$this->setKnownUuidFactory();
}
/**
* Tear down tests.
*/
protected function tearDown(): void
{
parent::tearDown();
Carbon::setTestNow();
CarbonImmutable::setTestNow();
}
/**
* Handles the known UUID handling in certain unit tests. Use the "KnownUuid" trait
* in order to enable this ability.
*/
public function setKnownUuidFactory()
{
// do nothing
}
}