From: Greg Beaver Date: Wed, 3 Dec 2003 23:46:10 +0000 (+0000) Subject: another test case, small fix for XML_RPC caching borking working tests X-Git-Tag: php-5.0.0b3RC1~361 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=172bf25830b753fd0e95ad5440be5b6bf6e2fe83;p=php another test case, small fix for XML_RPC caching borking working tests --- diff --git a/pear/tests/pear_downloader_old.phpt b/pear/tests/pear_downloader_old.phpt index 75bd0db1d8..f9082162ff 100644 --- a/pear/tests/pear_downloader_old.phpt +++ b/pear/tests/pear_downloader_old.phpt @@ -39,8 +39,13 @@ if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'tmp')) { if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'bin')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'bin'); } +if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'cache')) { + mkdir($temp_path . DIRECTORY_SEPARATOR . 'cache'); +} // make the fake configuration - we'll use one of these and it should work $config = serialize(array('master_server' => $server, + 'preferred_state' => 'stable', + 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', @@ -134,6 +139,65 @@ unlink($installpackages[0]['file']); unset($installpackages[0]['file']); var_dump($installpackages); +echo "Test package name with version download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-1.1'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "Test package name with state stable download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-stable'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "Test package name with state beta download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-beta'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "================\nTest preferred_state = beta\n"; +$config->set('preferred_state', 'beta'); + +echo "Test simple package name download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); chdir($curdir); cleanall($temp_path); @@ -307,4 +371,34 @@ array(1) { string(24) "required dependency test" } } -} \ No newline at end of file +} +Test package name with version download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +Test package name with state stable download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +Test package name with state beta download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +================ +Test preferred_state = beta +Test simple package name download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes