getAllFiles('php'); $files[] = BASE_PATH.'/sapphire/dev/install/config-form.html'; foreach($files as $i => $file) { $CLI_file = escapeshellarg($file); foreach($settingTests as $settingTest) { $returnCode = 0; $output = array(); exec("php -l -d $settingTest $CLI_file", $output, $returnCode); $hasErrors = ($returnCode != 0 && strpos('No syntax errors detected', implode("\n", $output)) === FALSE); $this->assertFalse($hasErrors, "Syntax error parsing $CLI_file with setting $settingTest:\n" . implode("\n", $output) . " (Returned: {$returnCode})"); } } } function getAllFiles($ext = 'php') { // TODO: Unix only $cmd = sprintf( 'find %s | grep %s', BASE_PATH, escapeshellarg("\.$ext\$") ); return explode("\n", trim(`$cmd`)); } }