diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml index 551092d74..307d33e7a 100644 --- a/app/config/parameters_test.yml +++ b/app/config/parameters_test.yml @@ -1,5 +1,2 @@ parameters: - # Using an environment variable in order to avoid the error "attempt to write a readonly database" - # when the schema is dropped then recreate - database_path: "%env(TEST_DATABASE_PATH)%" - env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" + database_path: "%kernel.project_dir%/data/db/wallabag_test.sqlite" diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml index ac76d61ec..c168aefa6 100644 --- a/app/config/tests/parameters_test.sqlite.yml +++ b/app/config/tests/parameters_test.sqlite.yml @@ -1,5 +1,2 @@ parameters: - env(DATABASE_URL): sqlite://:@localhost/%env(TEST_DATABASE_PATH)%?charset=utf8 - # Using an environment variable in order to avoid the error "attempt to write a readonly database" - # when the schema is dropped then recreate - env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" + env(DATABASE_URL): sqlite:///%kernel.project_dir%/data/db/wallabag_test.sqlite?charset=utf8 diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 83729d86b..fa137f685 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php @@ -56,7 +56,7 @@ class InstallCommandTest extends WallabagCoreTestCase // check the manual that corresponds to your MariaDB server version for the right syntax to use // near '/tmp/wallabag_testTYj1kp' at line 1 $databasePath = tempnam(sys_get_temp_dir(), 'wallabag_test'); - putenv("TEST_DATABASE_PATH=$databasePath"); + putenv("DATABASE_URL=sqlite:///$databasePath?charset=utf8"); // The environnement has been changed, recreate the client in order to update connection parent::setUp(); @@ -67,9 +67,10 @@ class InstallCommandTest extends WallabagCoreTestCase protected function tearDown(): void { - $databasePath = getenv('TEST_DATABASE_PATH'); - // Remove variable environnement - putenv('TEST_DATABASE_PATH'); + $databaseUrl = getenv('DATABASE_URL'); + $databasePath = parse_url($databaseUrl, \PHP_URL_PATH); + // Remove the real environnement variable + putenv('DATABASE_URL'); if ($databasePath && file_exists($databasePath)) { unlink($databasePath);