diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-02-16 03:15:52 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-02-16 03:15:52 +0000 |
commit | 96843fe43463633fb810b47234c87a0be4053320 (patch) | |
tree | 4675146732b285db1d75a367e3897686e8917463 /server-tests.php | |
parent | a790d6ed3dc537ad4bd61da0e466816ef5ed0f01 (diff) | |
download | php-git-96843fe43463633fb810b47234c87a0be4053320.tar.gz |
Use 5.1 functions
Diffstat (limited to 'server-tests.php')
-rwxr-xr-x | server-tests.php | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/server-tests.php b/server-tests.php index 7adc433d56..d8ae377dce 100755 --- a/server-tests.php +++ b/server-tests.php @@ -98,14 +98,6 @@ define('PHP_INI_SETTINGS_SCRIPT','<?php echo serialize(ini_get_all()); ?>'); * various utility functions */ -function save_to_file($filename,$text) -{ - $fp = @fopen($filename,'w') - or die("Cannot open file '" . $filename . "' (save_to_file)"); - fwrite($fp,$text); - fclose($fp); -} - function settings2array($settings, &$ini_settings) { foreach($settings as $setting) { @@ -578,7 +570,7 @@ class testHarness { $tmp_file = "$cwd$pi"; $pi = substr($cwd,strlen($this->conf['TEST_BASE_PATH'])) . $pi; $url = $this->conf['TEST_WEB_BASE_URL'] . $pi; - save_to_file($tmp_file,$script); + file_put_contents($tmp_file,$script); $fd = fopen($url, "rb"); $out = ''; if ($fd) { @@ -1285,7 +1277,7 @@ class testHarness { } // We've satisfied the preconditions - run the test! - save_to_file($tmp_file,$section_text['FILE']); + file_put_contents($tmp_file,$section_text['FILE']); $post = NULL; $args = ""; @@ -1507,25 +1499,25 @@ class testHarness { // write .exp if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'E') !== FALSE) { $logname = ereg_replace('\.phpt$','.exp',$file); - save_to_file($logname,$wanted); + file_put_contents($logname,$wanted); } // write .out if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'O') !== FALSE) { $logname = ereg_replace('\.phpt$','.out',$file); - save_to_file($logname,$output); + file_put_contents($logname,$output); } // write .diff if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'D') !== FALSE) { $logname = ereg_replace('\.phpt$','.diff',$file); - save_to_file($logname,generate_diff($wanted,$output)); + file_put_contents($logname,generate_diff($wanted,$output)); } // write .log if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'L') !== FALSE) { $logname = ereg_replace('\.phpt$','.log',$file); - save_to_file($logname, + file_put_contents($logname, "\n---- EXPECTED OUTPUT\n$wanted\n". "---- ACTUAL OUTPUT\n$output\n". "---- FAILED\n"); |