Skip to content

Commit 66a8110

Browse files
committed
Remove closure and make config file cacheable
1 parent 825da6b commit 66a8110

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

config/laravel-database-emails.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@
4242

4343
'email' => '[email protected]',
4444

45-
'enabled' => function () {
46-
return false;
47-
// ...or...
48-
// return app()->environment('local', 'staging');
49-
},
45+
'enabled' => env('LARAVEL_DATABASE_EMAILS_TESTING_ENABLED', true),
5046

5147
],
5248

tests/ConfigCacheTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use Throwable;
6+
7+
class ConfigCacheTest extends TestCase
8+
{
9+
/** @test */
10+
function the_configuration_file_can_be_cached()
11+
{
12+
$failed = false;
13+
14+
try {
15+
serialize(require __DIR__ . '/../config/laravel-database-emails.php');
16+
} catch (Throwable $e) {
17+
$failed = true;
18+
}
19+
20+
if ($failed) {
21+
$this->fail('Configuration file cannot be serialized');
22+
} else {
23+
$this->assertTrue(true);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)