public static function test_all_classes_compile_without_writing_to_stdout() { $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory(); $php_class_files = $project_directory->get_php_class_files(); $php_cli_interpreter = CLIScripts_InterpreterProgramHelper::get_php_cli_interpreter(); $temp_dir = Environment_MachineHelper::get_temporary_directory(); #print_r($temp_dir); exit; $tmp_out_file = $temp_dir->get_name() . '/haddock-compilations-tests-out.txt'; $tmp_err_file = $temp_dir->get_name() . '/haddock-compilations-tests-err.txt'; $define_debug_constants_file = PROJECT_ROOT . '/haddock/public-html/public-html/' . 'define-debug-constants.inc.php'; $autoload_inc_file_name = PROJECT_ROOT . '/haddock/haddock-project-organisation/includes/' . 'autoload.inc.php'; $total_out_length = 0; foreach ($php_class_files as $php_class_file) { $out_length = 0; self::conditionally_unlink_tmp_files($tmp_out_file, $tmp_err_file); $tmp_class_file_name = $temp_dir->get_name() . '/haddock-compilations-tests-tmp-' . $php_class_file->get_php_class_name() . '-class.php'; $fh = fopen($tmp_class_file_name, 'w'); if ($fh) { fwrite($fh, '<?php define(\'PROJECT_ROOT\', \'' . PROJECT_ROOT . '\'); ?>'); fwrite($fh, file_get_contents($define_debug_constants_file)); fwrite($fh, file_get_contents($autoload_inc_file_name)); fwrite($fh, file_get_contents($php_class_file->get_name())); fclose($fh); $cmd = "{$php_cli_interpreter} -f \"{$tmp_class_file_name}\" >> \"{$tmp_out_file}\" 2>> \"{$tmp_err_file}\""; #echo $cmd . PHP_EOL; system($cmd); $out_length = strlen(file_get_contents($tmp_out_file)) + strlen(file_get_contents($tmp_err_file)); if ($out_length == 0) { unlink($tmp_class_file_name); } } $total_out_length += $out_length; self::conditionally_unlink_tmp_files($tmp_out_file, $tmp_err_file); } return $total_out_length == 0; }
private static function get_table_specification_directory_name() { $temporary_directory = Environment_MachineHelper::get_temporary_directory(); return $temporary_directory->get_name() . DIRECTORY_SEPARATOR . 'database-describing-tests'; }