cvs: pear-core /tests/PEAR_Installer test_install_cfgrole_register_only.phpt
| From: | Greg Beaver | Date: | Wed, 14 May 2008 21:26:31 +0000 |
| Subject: | cvs: pear-core /tests/PEAR_Installer test_install_cfgrole_register_only.phpt | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7563@lists.php.net to get a copy of this message | ||
cellog Wed May 14 21:26:31 2008 UTC
Modified files:
/pear-core/tests/PEAR_Installer
test_install_cfgrole_register_only.phpt
Log:
* Fix Bug #13386 "pear install --register-only" fails with cfg role [cellog]
http://cvs.php.net/viewvc.cgi/pear-core/tests/PEAR_Installer/test_install_cfgrole_register_only.phpt?r1=1.1&r2=1.2&diff_format=u
Index: pear-core/tests/PEAR_Installer/test_install_cfgrole_register_only.phpt
diff -u pear-core/tests/PEAR_Installer/test_install_cfgrole_register_only.phpt:1.1
pear-core/tests/PEAR_Installer/test_install_cfgrole_register_only.phpt:1.2
--- pear-core/tests/PEAR_Installer/test_install_cfgrole_register_only.phpt:1.1 Tue May 13 05:20:38
2008
+++ pear-core/tests/PEAR_Installer/test_install_cfgrole_register_only.phpt Wed May 14 21:26:31 2008
@@ -6,8 +6,6 @@
echo 'skip';
}
?>
---INI--
-error_reporting=0
--FILE--
<?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
@@ -37,7 +35,7 @@
$ret = &$installer->install($result[0], $dp->getOptions());
$phpunit->assertNoErrors('after install');
$phpunit->assertEquals(array (
- 'attribs' =>
+ 'attribs' =>
array (
'version' => '2.0',
'xmlns' => 'http://pear.php.net/dtd/package-2.0',
@@ -49,7 +47,7 @@
'channel' => 'pear.php.net',
'summary' => 'PEAR Base System',
'description' => 'The PEAR package contains:',
- 'lead' =>
+ 'lead' =>
array (
'name' => 'Stig Bakken',
'user' => 'ssb',
@@ -57,36 +55,36 @@
'active' => 'yes',
),
'date' => '2004-09-30',
- 'version' =>
+ 'version' =>
array (
'release' => '1.4.0',
'api' => '1.4.0',
),
- 'stability' =>
+ 'stability' =>
array (
'release' => 'stable',
'api' => 'stable',
),
- 'license' =>
+ 'license' =>
array (
- 'attribs' =>
+ 'attribs' =>
array (
'uri' => 'http://www.php.net/license/3_0.txt',
),
'_content' => 'PHP License',
),
'notes' => 'Installer Roles/Tasks:',
- 'contents' =>
+ 'contents' =>
array (
- 'dir' =>
+ 'dir' =>
array (
- 'attribs' =>
+ 'attribs' =>
array (
'name' => '/',
),
- 'file' =>
+ 'file' =>
array (
- 'attribs' =>
+ 'attribs' =>
array (
'name' => 'foo.php',
'role' => 'cfg',
@@ -94,24 +92,24 @@
),
),
),
- 'dependencies' =>
+ 'dependencies' =>
array (
- 'required' =>
+ 'required' =>
array (
- 'php' =>
+ 'php' =>
array (
'min' => '4.2',
),
- 'pearinstaller' =>
+ 'pearinstaller' =>
array (
'min' => '1.7.0',
),
),
),
'phprelease' => '',
- 'filelist' =>
+ 'filelist' =>
array (
- 'foo.php' =>
+ 'foo.php' =>
array (
'name' => 'foo.php',
'role' => 'cfg',
@@ -120,27 +118,27 @@
),
),
'_lastversion' => NULL,
- 'dirtree' =>
+ 'dirtree' =>
array (
$temp_path . DIRECTORY_SEPARATOR . 'cfg' . DIRECTORY_SEPARATOR . 'PEAR'
=> true,
),
- 'old' =>
+ 'old' =>
array (
'version' => '1.4.0',
'release_date' => '2004-09-30',
'release_state' => 'stable',
'release_license' => 'PHP License',
'release_notes' => 'Installer Roles/Tasks:',
- 'release_deps' =>
+ 'release_deps' =>
array (
- 0 =>
+ 0 =>
array (
'type' => 'php',
'rel' => 'ge',
'version' => '4.2',
'optional' => 'no',
),
- 1 =>
+ 1 =>
array (
'type' => 'pkg',
'channel' => 'pear.php.net',
@@ -150,9 +148,9 @@
'optional' => 'no',
),
),
- 'maintainers' =>
+ 'maintainers' =>
array (
- 0 =>
+ 0 =>
array (
'name' => 'Stig Bakken',
'email' => 'stig@php.net',
@@ -171,7 +169,7 @@
$info = $reg->packageInfo('PEAR');
$d = DIRECTORY_SEPARATOR;
$phpunit->assertEquals( array (
- 'foo.php' =>
+ 'foo.php' =>
array (
'name' => 'foo.php',
'role' => 'cfg',
@@ -179,6 +177,38 @@
),
)
, $info['filelist'], 'filelist');
+
+$dp = &new test_PEAR_Downloader($fakelog, array('register-only' => true,
'upgrade' => true), $config);
+$phpunit->assertNoErrors('after create');
+$result = $dp->download(array($c2));
+$after = $dp->getDownloadedPackages();
+$phpunit->assertEquals(1, 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->assertFileNotExists($temp_path . DIRECTORY_SEPARATOR . 'cfg' .
DIRECTORY_SEPARATOR . 'PEAR' . DIRECTORY_SEPARATOR . 'foo.php',
+ 'installed file');
+$fakelog->getLog();
+$reg = &$config->getRegistry();
+$info = $reg->packageInfo('PEAR');
+$d = DIRECTORY_SEPARATOR;
+$phpunit->assertEquals( array (
+ 'foo.php' =>
+ array (
+ 'name' => 'foo.php',
+ 'role' => 'cfg',
+ 'installed_as' => $temp_path . $d . 'cfg' . $d . 'PEAR' . $d .
'foo.php',
+ ),
+ )
+, $info['filelist'], 'filelist');
+
echo 'tests done';
?>
--CLEAN--