Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

257 lines (243 sloc) 8.814 kB
--TEST--
PEAR_Installer->install() with simple local package.xml, remote ftp install
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
die('skip');
}
include_once 'PEAR/Common.php';
if (!class_exists('PEAR_Common')) {
die('skip must have PEAR_Common');
}
if (!PEAR_Common::isIncludeable('Net/FTP.php') || !PEAR_Common::isIncludeable('PEAR/FTP.php')) {
die('skip requires PEAR_RemoteInstaller to work');
}
?>
--FILE--
<?php
if (defined('PATH_SEPARATOR')) {
$ps = PATH_SEPARATOR;
} else {
if (substr(PHP_OS, 0, 3) == 'WIN') {
$ps = ';';
} else {
$ps = PATH_SEPARATOR;
}
}
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
include_once dirname(__FILE__) . '/ftp_test_files/FTP.php.inc';
$installer = &new test_PEAR_RemoteInstaller($fakelog);
$ftp = &Net_FTP::singleton();
$ftp->addRemoteFile('remote.ini', dirname(__FILE__) . DIRECTORY_SEPARATOR .
'ftp_test_files' . DIRECTORY_SEPARATOR . 'remote.ini');
$config->readFTPConfigFile('ftp://www.example.com/remote.ini');
$pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR .
'packages'. DIRECTORY_SEPARATOR . 'simplepackage.xml';
$dp = &new test_PEAR_Downloader($fakelog, array(), $config);
$phpunit->assertNoErrors('after create');
$result = $dp->download(array($pathtopackagexml));
$phpunit->assertEquals(1, count($result), 'return');
$phpunit->assertIsa('test_PEAR_Downloader_Package', $result[0], 'right class');
$phpunit->assertIsa('PEAR_PackageFile_v1', $pf = $result[0]->getPackageFile(), 'right kind of pf');
$phpunit->assertEquals('PEAR', $pf->getPackage(), 'right package');
$phpunit->assertEquals('pear.php.net', $pf->getChannel(), 'right channel');
$dlpackages = $dp->getDownloadedPackages();
$phpunit->assertEquals(1, count($dlpackages), 'downloaded packages count');
$phpunit->assertEquals(3, count($dlpackages[0]), 'internals package count');
$phpunit->assertEquals(array('file', 'info', 'pkg'), array_keys($dlpackages[0]), 'indexes');
$phpunit->assertEquals($pathtopackagexml,
$dlpackages[0]['file'], 'file');
$phpunit->assertIsa('PEAR_PackageFile_v1',
$dlpackages[0]['info'], 'info');
$phpunit->assertEquals('PEAR',
$dlpackages[0]['pkg'], 'PEAR');
$after = $dp->getDownloadedPackages();
$phpunit->assertEquals(0, count($after), 'after getdp count');
$phpunit->assertEquals(array (), $fakelog->getLog(), 'log messages');
$phpunit->assertEquals(array (
), $fakelog->getDownload(), 'download callback messages');
$installer->setOptions($dp->getOptions());
$installer->sortPackagesForInstall($result);
$installer->setDownloadedPackages($result);
$phpunit->assertNoErrors('set of downloaded packages');
$ret = &$installer->install($result[0], $dp->getOptions());
$phpunit->assertNoErrors('after install');
$phpunit->assertEquals(array (
'provides' =>
array (
'class;OS_Guess' =>
array (
'type' => 'class',
'name' => 'OS_Guess',
'explicit' => true,
),
'class;System' =>
array (
'type' => 'class',
'name' => 'System',
'explicit' => true,
),
'function;md5_file' =>
array (
'type' => 'function',
'name' => 'md5_file',
'explicit' => true,
),
),
'filelist' =>
array (
'foo.php' =>
array (
'role' => 'php',
'installed_as' => $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php',
),
),
'xsdversion' => '1.0',
'package' => 'PEAR',
'summary' => 'PEAR Base System',
'description' => 'The PEAR package contains:
* the PEAR installer, for creating, distributing
and installing packages
* the alpha-quality PEAR_Exception PHP5 error handling mechanism
* the beta-quality PEAR_ErrorStack advanced error handling mechanism
* the PEAR_Error error handling mechanism
* the OS_Guess class for retrieving info about the OS
where PHP is running on
* the System class for quick handling of common operations
with files and directories
* the PEAR base class
',
'maintainers' =>
array (
0 =>
array (
'handle' => 'ssb',
'role' => 'lead',
'name' => 'Stig Bakken',
'email' => 'stig@php.net',
),
1 =>
array (
'handle' => 'cellog',
'role' => 'lead',
'name' => 'Greg Beaver',
'email' => 'cellog@php.net',
),
2 =>
array (
'handle' => 'cox',
'role' => 'lead',
'name' => 'Tomas V.V.Cox',
'email' => 'cox@idecnet.com',
),
3 =>
array (
'handle' => 'pajoye',
'role' => 'lead',
'name' => 'Pierre-Alain Joye',
'email' => 'pajoye@pearfr.org',
),
4 =>
array (
'handle' => 'mj',
'role' => 'developer',
'name' => 'Martin Jansen',
'email' => 'mj@php.net',
),
),
'version' => '1.4.0a1',
'release_date' => '2004-10-21',
'release_license' => 'PHP License',
'release_state' => 'alpha',
'release_notes' => 'Installer Roles/Tasks:
* package.xml 2.0 uses a command pattern, allowing extensibility
* implement the replace, postinstallscript, and preinstallscript tasks
Installer Dependency Support:
* package.xml 2.0 has continued to improve and evolve
* Downloader/Package.php is now used to coordinate downloading. Old code
has not yet been deleted, as error handling is crappy right now. Uninstall
ordering is broken, and needs to be redone.
* Pre-download dependency resolution works, mostly.
* There is no way to disable dependency resolution at the moment, this will be done.
* Dependency2.php is used by the new PEAR_Downloader_Channel to resolve dependencies
and include downloaded files in the calculations.
* DependencyDB.php is used to resolve complex dependencies between installed packages
and any dependencies installed later (a conflicts/not dependency cannot be honored
without this DB)
Installer Channel Support:
* channel XSD is available on pearweb
* add channel.listAll and channel.update to default PEAR protocols
* add ability to "pear channel-update channelname" to
retrieve updates manually for individual channels
* fix channel.xml generation to use a valid schema declaration
Installer:
* with --remoteconfig option, it is possible to remotely install and uninstall packages
to an FTP server. It works by mirroring a local installation, and requires a
special, separate local install.
* Channels implemented
* Bug #1242: array-to-string conversion
* fix Bug #2189 upgrade-all stops if dependancy fails
* fix Bug #1637 The use of interface causes warnings when packaging with PEAR
* fix Bug #1420 Parser bug for T_DOUBLE_COLON
* fix Request #2220 pear5 build fails on dual php4/php5 system
* Major bug in Registry - false file conflicts on data/doc/test role
was possible (and would happen if HTML_Template_IT was installed
and HTML_Template_Flexy installation was attempted)
',
'changelog' =>
array (
0 =>
array (
'version' => '1.3.3',
'release_date' => '2004-10-28',
'release_state' => 'stable',
'release_notes' => 'Installer:
* fix Bug #1186 raise a notice error on PEAR::Common $_packageName
* fix Bug #1249 display the right state when using --force option
* fix Bug #2189 upgrade-all stops if dependancy fails
* fix Bug #1637 The use of interface causes warnings when packaging with PEAR
* fix Bug #1420 Parser bug for T_DOUBLE_COLON
* fix Request #2220 pear5 build fails on dual php4/php5 system
* fix Bug #1163 pear makerpm fails with packages that supply role="doc"
Other:
* add PEAR_Exception class for PHP5 users
* fix critical problem in package.xml for linux in 1.3.2
* fix staticPopCallback() in PEAR_ErrorStack
* fix warning in PEAR_Registry for windows 98 users
',
),
),
'_lastversion' => null,
'dirtree' =>
array (
$temp_path . DIRECTORY_SEPARATOR . 'php' => true,
),
), $ret, 'return of install');
$phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php',
'installed file');
$reg = &$config->getRegistry();
$info = $reg->packageInfo('PEAR');
$phpunit->assertTrue(isset($info['_lastmodified']), 'lastmodified is set?');
unset($info['_lastmodified']);
$phpunit->assertEquals($ret, $info, 'test installation');
$installer->ftpInstall($result[0]);
$phpunit->assertNoErrors('ftp');
$phpunit->assertEquals(array (
'/path' => true,
'/path/to' => true,
'/path/to/pear' => true,
'/path/to/pear/pear' => true,
'/path/to/pear/pear/php' => true,
), $ftp->_dirsMade, 'dirs made remotely');
$phpunit->assertEquals(array (
$temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php' =>
'/path/to/pear/pear/php/foo.php',
), $ftp->_putfiles, 'files saved remotely');
echo 'tests done';
?>
--CLEAN--
<?php
require_once dirname(__FILE__) . '/teardown.php.inc';
?>
--EXPECT--
tests done
Jump to Line
Something went wrong with that request. Please try again.