Testing: Updated app key test

To be better contained prevent impacting of other tests
This commit is contained in:
Dan Brown
2026-09-15 12:20:37 +01:00
parent 7782ea00df
commit b5641aa00d
+10 -3
View File
@@ -2,6 +2,7 @@
namespace Tests\Unit;
use Exception;
use Illuminate\Encryption\MissingAppKeyException;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
@@ -215,9 +216,15 @@ class ConfigTest extends TestCase
public function test_app_errors_if_no_app_key_set()
{
$this->runWithEnv(['APP_KEY' => null], function () {
$this->expectException(MissingAppKeyException::class);
$this->get('/');
$this->runWithEnv(['APP_KEY' => ''], function () {
$error = null;
try {
$this->get('/');
} catch (Exception $e) {
$error = $e;
}
$this->assertInstanceOf(MissingAppKeyException::class, $error);
});
}