diff --git a/app/Config/app.php b/app/Config/app.php index c38cd0e1f..8424e53b0 100644 --- a/app/Config/app.php +++ b/app/Config/app.php @@ -120,7 +120,7 @@ return [ 'auto_detect_locale' => env('APP_AUTO_LANG_PUBLIC', true), // Encryption key - 'key' => env('APP_KEY', 'AbAZchsay4uBTU33RubBzLKw203yqSqr'), + 'key' => env('APP_KEY'), // Encryption cipher 'cipher' => 'AES-256-CBC', diff --git a/phpunit.xml b/phpunit.xml index 55d84d129..ac30d2adf 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -17,6 +17,7 @@ + diff --git a/tests/Unit/ConfigTest.php b/tests/Unit/ConfigTest.php index 2e9190dfd..9f3e5f56f 100644 --- a/tests/Unit/ConfigTest.php +++ b/tests/Unit/ConfigTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit; +use Illuminate\Encryption\MissingAppKeyException; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; @@ -212,8 +213,16 @@ 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('/'); + }); + } + /** - * Set an environment variable of the given name and value + * Set an environment variable of the given name and value, * then check the given config key to see if it matches the given result. * Providing a null $envVal clears the variable. */