From: Greg Beaver Date: Fri, 31 Oct 2003 22:46:57 +0000 (+0000) Subject: add fancy SKIPIF code, fix test X-Git-Tag: php-5.0.0b3RC1~806 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4150d6095c1b36fd86a063d9f5fecb21ba5421b;p=php add fancy SKIPIF code, fix test --- diff --git a/pear/tests/pear_installer2.phpt b/pear/tests/pear_installer2.phpt index 39cd9d9d4d..daee603cdd 100644 --- a/pear/tests/pear_installer2.phpt +++ b/pear/tests/pear_installer2.phpt @@ -1,7 +1,11 @@ --TEST-- PEAR_Installer test #2 --SKIPIF-- -skip + --FILE-- _installFile('installer2.phpt.testfile.php', array('role' => $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()); echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); if (is_object($err)) { - echo 'message: ' . $err->getMessage() . "\n"; + echo 'message: ' . ($err->getMessage() == 'bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . + DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php' ? 'match' : 'no match') . "\n"; } echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); echo "test invalid md5sum with --force:\n"; +ob_start(); $err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', 'md5sum' => md5('oops stuff')), $temp_path . DIRECTORY_SEPARATOR . 'tmp', array('force' => true)); +$warning = ob_get_contents(); +ob_end_clean(); +echo 'warning : '; +echo ($warning == 'warning : bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . + DIRECTORY_SEPARATOR . "installer2.phpt.testfile.php\n" ? "match\n" : "no match\n"); echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); if (is_object($err)) { - echo 'message: ' . $err->getMessage() . "\n"; + echo 'message: ' . ($err->getMessage() == 'bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . + DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php' ? 'match' : 'no match') . "\n"; } echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . @@ -351,10 +363,10 @@ int(1) file bin/.tmpinstaller2.phpt.testfile.php exists? => yes test invalid md5sum: returned PEAR_Error: yes -message: bad md5sum for file c:\web pages\chiara\testinstallertemp\bin\installer2.phpt.testfile.php +message: match file bin/.tmpinstaller2.phpt.testfile.php exists? => no test invalid md5sum with --force: -warning : bad md5sum for file c:\web pages\chiara\testinstallertemp\bin\installer2.phpt.testfile.php +warning : match returned PEAR_Error: no file bin/.tmpinstaller2.phpt.testfile.php exists? => yes