skip('lib/CactiProcess.php absent — feature PR #7073 not merged into develop yet'); return; } require_once dirname(__DIR__, 2) . '/lib/database.php'; require_once dirname(__DIR__, 2) . '/lib/functions.php'; test('db_dump_data executes and handles output file via Symfony Process', function () { // We need some Cacti globals to avoid fatal errors in db_dump_data global $database_default, $database_username, $database_password; $database_default = 'cacti'; $database_username = 'cactiuser'; $database_password = 'cactipassword'; $temp_file = tempnam(sys_get_temp_dir(), 'cacti_dump_test'); // Mock a scenario where mysqldump might not be available or fails // But we want to test the wrapper's logic for opening files and calling Symfony Process. // Since we can't easily mock the binary on this environment, we'll test the path logic. $retval = db_dump_data('test_db', '', [], $temp_file, '--version'); // Even if it fails (exit code 1 or 127), we verify it attempted to write/touch the file // or logged the correct errors. expect(file_exists($temp_file))->toBeTrue(); // nosemgrep: php.lang.security.unlink-use.unlink-use - tempnam() output, not user input unlink($temp_file); });