#!/usr/bin/env php &$argument) { // IP mapping $argument = str_replace(array('127.0.0.1', 'localhost'), $hostIp, $argument); // Paths mapping $filePath = $argument; if (file_exists($filePath)) { if (strpos($filePath, $projectDirHost) !== false) { // Mapping project paths to remote paths $arguments[$index] = str_replace($projectDirHost, $projectDirGuest, $filePath); } else { // Mapping any other local system paths to remote paths, upload files if(!is_dir($homeDirHost . '/scripts/')) { mkdir($homeDirHost . '/scripts/', 0777, true); } copy($filePath, $homeDirHost . '/scripts/' . basename($filePath)); $arguments[$index] = $homeDirGuest . '/scripts/' . basename($filePath); } } $argument = escapeshellarg($argument); } // Get XDEBUG environment variable $env = ''; if (isset($_SERVER['XDEBUG_CONFIG'])) { $env = "XDEBUG_CONFIG='" . $_SERVER['XDEBUG_CONFIG'] . "'"; } $includePaths = array('.', $projectDirGuest . '/vendor/phpunit/phpunit'); $arguments = array_merge(array('-d', 'include_path=' . implode(':', $includePaths)), $arguments); passthru($pipe . '"' .$commandPrefix. ' ' . $env . ' php ' . implode(' ', $arguments) . '"');