Auto create .env files

This commit is contained in:
2023-01-11 16:30:51 +09:00
parent 3668e6552c
commit dd2274f3b1
6 changed files with 101 additions and 5 deletions

View File

@@ -13,6 +13,32 @@ use PHPUnit\Framework\TestCase;
*/
final class DotEnvTest extends TestCase
{
/**
* setup the .env files before test run
*
* @return void
*/
protected function setUp(): void
{
// create .env files
$file_content = __DIR__ . DIRECTORY_SEPARATOR
. 'dotenv' . DIRECTORY_SEPARATOR
. 'test.env';
$env_files = [
__DIR__ . DIRECTORY_SEPARATOR
. 'dotenv' . DIRECTORY_SEPARATOR
. '.env',
__DIR__ . DIRECTORY_SEPARATOR
. '.env',
];
// if not found, skip -> all will fail
if (is_file($file_content)) {
foreach ($env_files as $env_file) {
copy($file_content, $env_file);
}
}
}
/**
* Undocumented function
*