- /**
- * Ensure next tests will have a clean database
- */
- public static function tearDownAfterClass()
- {
- $application = new Application(static::$kernel);
- $application->setAutoExit(false);
+ if ($connection->getDatabasePlatform() instanceof SqlitePlatform) {
+ // Environnement variable useful only for sqlite to avoid the error "attempt to write a readonly database"
+ // We can't define always this environnement variable because pdo_mysql seems to use it
+ // and we have the error:
+ // SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;
+ // 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");
+
+ // The environnement has been changed, recreate the client in order to update connection
+ parent::setUp();
+ }