2015-12-06 19:58:49 +01:00
|
|
|
<?php
|
|
|
|
|
2017-06-14 06:25:37 +02:00
|
|
|
namespace Tests;
|
2015-12-06 19:58:49 +01:00
|
|
|
|
2018-01-14 20:30:55 +01:00
|
|
|
use Cake\Chronos\Chronos;
|
2017-06-14 06:25:37 +02:00
|
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
2015-12-06 19:58:49 +01:00
|
|
|
|
2017-06-14 06:25:37 +02:00
|
|
|
abstract class TestCase extends BaseTestCase
|
|
|
|
{
|
2017-07-01 22:29:49 +02:00
|
|
|
use CreatesApplication;
|
2017-06-25 02:49:09 +02:00
|
|
|
|
2017-10-08 06:29:08 +02:00
|
|
|
/**
|
|
|
|
* Setup tests.
|
|
|
|
*/
|
2020-05-09 18:00:52 +02:00
|
|
|
public function setUp(): void
|
2017-06-25 02:49:09 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
2017-10-08 06:29:08 +02:00
|
|
|
|
2020-10-11 01:51:44 +02: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
|
|
|
|
// be setup correctly to display thier 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);
|
|
|
|
|
2017-10-08 06:29:08 +02:00
|
|
|
$this->setKnownUuidFactory();
|
|
|
|
}
|
|
|
|
|
2018-01-14 20:30:55 +01:00
|
|
|
/**
|
|
|
|
* Tear down tests.
|
|
|
|
*/
|
2020-05-09 18:00:52 +02:00
|
|
|
protected function tearDown(): void
|
2018-01-14 20:30:55 +01:00
|
|
|
{
|
|
|
|
parent::tearDown();
|
|
|
|
|
|
|
|
Chronos::setTestNow();
|
|
|
|
}
|
|
|
|
|
2017-10-08 06:29:08 +02: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 02:49:09 +02:00
|
|
|
}
|
2015-12-06 19:58:49 +01:00
|
|
|
}
|