PDO::ERRMODE_EXCEPTION]); $config = new Config([ 'paths' => ['migrations' => dirname(__DIR__, 2) . '/db/migrations'], 'environments' => [ 'default_migration_table' => 'phinxlog', 'default_database' => 'test', 'test' => ['adapter' => 'sqlite', 'connection' => $pdo], ], ]); (new Manager($config, new ArrayInput([]), new NullOutput()))->migrate('test'); $pdo->exec('PRAGMA foreign_keys = ON'); $pdo->exec('PRAGMA busy_timeout = 5000'); return $pdo; } public static function directory(string $prefix): string { $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'meshvault-' . $prefix . '-' . bin2hex(random_bytes(6)); mkdir($path, 0777, true); return (string) realpath($path); } public static function remove(string $path): void { foreach (array_diff(@scandir($path) ?: [], ['.', '..']) as $entry) { $child = $path . DIRECTORY_SEPARATOR . $entry; is_dir($child) ? self::remove($child) : @unlink($child); } @rmdir($path); } }