Файл: vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php
Строк: 128
<?php
namespace IlluminateFoundationTesting;
use PHPUnitFrameworkTestCase as BaseTestCase;
use Throwable;
abstract class TestCase extends BaseTestCase
{
use ConcernsInteractsWithContainer,
ConcernsMakesHttpRequests,
ConcernsInteractsWithAuthentication,
ConcernsInteractsWithConsole,
ConcernsInteractsWithDatabase,
ConcernsInteractsWithDeprecationHandling,
ConcernsInteractsWithExceptionHandling,
ConcernsInteractsWithSession,
ConcernsInteractsWithTime,
ConcernsInteractsWithTestCaseLifecycle,
ConcernsInteractsWithViews;
/**
* Creates the application.
*
* Needs to be implemented by subclasses.
*
* @return SymfonyComponentHttpKernelHttpKernelInterface
*/
abstract public function createApplication();
/**
* Setup the test environment.
*
* @return void
*/
protected function setUp(): void
{
static::$latestResponse = null;
$this->setUpTheTestEnvironment();
}
/**
* Refresh the application instance.
*
* @return void
*/
protected function refreshApplication()
{
$this->app = $this->createApplication();
}
/**
* {@inheritdoc}
*/
protected function runTest(): mixed
{
$result = null;
try {
$result = parent::runTest();
} catch (Throwable $e) {
if (! is_null(static::$latestResponse)) {
static::$latestResponse->transformNotSuccessfulException($e);
}
throw $e;
}
return $result;
}
/**
* Clean up the testing environment before the next test.
*
* @return void
*
* @throws MockeryExceptionInvalidCountException
*/
protected function tearDown(): void
{
$this->tearDownTheTestEnvironment();
}
/**
* Clean up the testing environment before the next test case.
*
* @return void
*/
public static function tearDownAfterClass(): void
{
static::$latestResponse = null;
static::tearDownAfterClassUsingTestCase();
}
}