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',
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);
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