*/ dataset('templates', function () { return [ '.env.example' => [__DIR__.'/../../.env.example'], 'installer' => [__DIR__.'/../../app/Http/Controllers/Web/InstallController.php'], ]; }); test('template names a configured mailer', function (string $path) { $mailer = valueOf('MAIL_MAILER', $path); $this->assertArrayHasKey( $mailer, config('mail.mailers'), "MAIL_MAILER=$mailer is not defined in config/mail.php." ); })->with('templates'); test('template ships with demo mode off', function (string $path) { $this->assertSame('false', valueOf('DEMO_MODE', $path)); })->with('templates'); test('template names a configured database connection', function (string $path) { $connection = valueOf('DB_CONNECTION', $path); $this->assertArrayHasKey( $connection, config('database.connections'), "DB_CONNECTION=$connection is not defined in config/database.php." ); })->with('templates'); /** * Read a single environment value out of a template. */ function valueOf(string $key, string $path): string { test()->assertFileExists($path); $matched = preg_match('/^\s*'.preg_quote($key, '/').'=(.*)$/m', file_get_contents($path), $matches); test()->assertSame(1, $matched, "$key is not present in ".basename($path).'.'); return trim($matches[1], " \t\"'"); }