Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"league/flysystem-read-only": "^3.25.1",
"league/flysystem-sftp-v3": "^3.25.1",
"mockery/mockery": "^1.6.10",
"orchestra/testbench-core": "^10.0.0",
"orchestra/testbench-core": "10.x-dev#57a17219",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update this once this has been merged.

"pda/pheanstalk": "^5.0.6|^7.0.0",
"php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '12.23.1';
const VERSION = '12.23.2';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just to make sure Testbench logic works correctly:

image


/**
* The base path for the Laravel installation.
Expand Down
17 changes: 13 additions & 4 deletions src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Illuminate\Log\LogManager;
use Illuminate\Support\Env;
use Monolog\Handler\NullHandler;
use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\ErrorHandler;
use PHPUnit\Runner\Version;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\ErrorHandler\Error\FatalError;
use Throwable;
Expand Down Expand Up @@ -304,15 +306,16 @@ public static function forgetApp()
/**
* Flush the bootstrapper's global state.
*
* @param \PHPUnit\Framework\TestCase|null $testCase
* @return void
*/
public static function flushState()
public static function flushState(?TestCase $testCase = null)
{
if (is_null(static::$app)) {
return;
}

static::flushHandlersState();
static::flushHandlersState($testCase);

static::$app = null;

Expand All @@ -322,9 +325,10 @@ public static function flushState()
/**
* Flush the bootstrapper's global handlers state.
*
* @param \PHPUnit\Framework\TestCase|null $testCase
* @return void
*/
public static function flushHandlersState()
public static function flushHandlersState(?TestCase $testCase = null)
{
while (get_exception_handler() !== null) {
restore_exception_handler();
Expand All @@ -339,7 +343,12 @@ public static function flushHandlersState()

if ((fn () => $this->enabled ?? false)->call($instance)) {
$instance->disable();
$instance->enable();

if (version_compare(Version::id(), '12.3.4', '>=')) {
$instance->enable($testCase);
} else {
$instance->enable();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public function setUpRedis()
*/
public function tearDownRedis()
{
if (static::$connectionFailedOnceWithDefaultsSkip === true) {
return;
}

if (isset($this->redis['phpredis'])) {
$this->redis['phpredis']->connection()->flushdb();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function tearDownTheTestEnvironment(): void
Factory::flushState();
EncodedHtmlString::flushState();
EncryptCookies::flushState();
HandleExceptions::flushState();
HandleExceptions::flushState($this);
Markdown::flushState();
Migrator::withoutMigrations([]);
Once::flush();
Expand Down
2 changes: 1 addition & 1 deletion tests/Foundation/Bootstrap/HandleExceptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function handleExceptions()
protected function tearDown(): void
{
Application::setInstance(null);
HandleExceptions::flushState();
HandleExceptions::flushState($this);

m::close();
}
Expand Down