mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
Merge pull request #7181 from yguedidi/remove-need-for-test_database_path
Remove need for TEST_DATABASE_PATH
This commit is contained in:
commit
325ff1a419
3 changed files with 7 additions and 12 deletions
|
@ -1,5 +1,2 @@
|
||||||
parameters:
|
parameters:
|
||||||
# Using an environment variable in order to avoid the error "attempt to write a readonly database"
|
database_path: "%kernel.project_dir%/data/db/wallabag_test.sqlite"
|
||||||
# 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"
|
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
parameters:
|
parameters:
|
||||||
env(DATABASE_URL): sqlite://:@localhost/%env(TEST_DATABASE_PATH)%?charset=utf8
|
env(DATABASE_URL): sqlite:///%kernel.project_dir%/data/db/wallabag_test.sqlite?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"
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||||
// check the manual that corresponds to your MariaDB server version for the right syntax to use
|
// check the manual that corresponds to your MariaDB server version for the right syntax to use
|
||||||
// near '/tmp/wallabag_testTYj1kp' at line 1
|
// near '/tmp/wallabag_testTYj1kp' at line 1
|
||||||
$databasePath = tempnam(sys_get_temp_dir(), 'wallabag_test');
|
$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
|
// The environnement has been changed, recreate the client in order to update connection
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
@ -67,9 +67,10 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$databasePath = getenv('TEST_DATABASE_PATH');
|
$databaseUrl = getenv('DATABASE_URL');
|
||||||
// Remove variable environnement
|
$databasePath = parse_url($databaseUrl, \PHP_URL_PATH);
|
||||||
putenv('TEST_DATABASE_PATH');
|
// Remove the real environnement variable
|
||||||
|
putenv('DATABASE_URL');
|
||||||
|
|
||||||
if ($databasePath && file_exists($databasePath)) {
|
if ($databasePath && file_exists($databasePath)) {
|
||||||
unlink($databasePath);
|
unlink($databasePath);
|
||||||
|
|
Loading…
Reference in a new issue