cvs: pear-core /tests/PEAR_Downloader setup.php.inc test_sortPackagesForInstall.phpt test_sortPackagesForInstall_recursion1.phpt
test_sortPackagesForInstall_recursion2.phpt /tests/PEAR_PackageFile/v1 test_dependsOn.phpt /tests/PEAR_PackageFile/v1/Parser/test_basicparse
test-1.0.tgz /tests/PEAR_PackageFile/v2 setup.php.inc test_dependsOn.phpt
| From: | Greg Beaver | Date: | Tue, 19 Oct 2004 21:12:11 +0000 |
| Subject: | cvs: pear-core /tests/PEAR_Downloader setup.php.inc test_sortPackagesForInstall.phpt test_sortPackagesForInstall_recursion1.phpt test_sortPackagesForInstall_recursion2.phpt /tests/PEAR_PackageFile/v1 test_dependsOn.phpt /tests/PEAR_PackageFile/v1/Parser/test_basicparse test-1.0.tgz /tests/PEAR_PackageFile/v2 setup.php.inc test_dependsOn.phpt |
||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-1073@lists.php.net to get a copy of this message | ||
cellog Tue Oct 19 17:12:11 2004 EDT
Added files:
/pear-core/tests/PEAR_Downloader setup.php.inc
test_sortPackagesForInstall.phpt
test_sortPackagesForInstall_recursion1.phpt
test_sortPackagesForInstall_recursion2.phpt
/pear-core/tests/PEAR_PackageFile/v1/Parser/test_basicparse
test-1.0.tgz
/pear-core/tests/PEAR_PackageFile/v1 test_dependsOn.phpt
/pear-core/tests/PEAR_PackageFile/v2 setup.php.inc
test_dependsOn.phpt
Log:
TRUE installation and download dependency resolution. (tests)
@todo write and unit test uninstall dependency resolution
http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/setup.php.inc?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/setup.php.inc +++ pear-core/tests/PEAR_Downloader/setup.php.inc <?php $server = 'pear.Chiara'; //$server = 'test.pear.php.net'; $temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'; function cleanall($dir = null) { if ($dir !== null) { $statedir = $dir; } else { $statedir = $GLOBALS['temp_path']; } if (file_exists($statedir)) { $dp = opendir($statedir); while ($ent = readdir($dp)) { if (in_array($ent, array('.', '..'))) { continue; } if (is_dir($statedir . DIRECTORY_SEPARATOR . $ent)) { cleanall($statedir . DIRECTORY_SEPARATOR . $ent); continue; } unlink($statedir . DIRECTORY_SEPARATOR . $ent); } closedir($dp); rmdir($statedir); } } register_shutdown_function('cleanall'); cleanall($temp_path); if (!is_dir($temp_path)) { mkdir($temp_path); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'php')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'php'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'data')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'data'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'doc')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'test')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'test'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'ext')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'script')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'script'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'tmp')) { mkdir($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', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/Downloader.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = &new PEAR_PHPTest(true); class fake_log { var $_log = array(); function log($level, $message) { $this->_log[] = array($level, $message); } function getLog() { $log = $this->_log; $this->_log = array(); return $log; } } $fakelog = new fake_log; $config = &new PEAR_Config($temp_path . '/pear.ini'); function &newDownloader($options) { global $config; $downloader = &new test_PEAR_Downloader($fakelog, $options, $config); return $downloader; } ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall.phpt +++ pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall.phpt --TEST-- PEAR_Downloader->sortPackagesForInstall() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; $pf1 = new PEAR_PackageFile_v2; $pf1->setPackage('uberparent'); $pf1->setChannel('pear.poop.net'); $pf1->addPackageDepWithChannel('required', 'indirect', 'pear.php.net'); $pf2 = new PEAR_PackageFile_v1; $pf2->setPackage('indirect'); $pf2->addPackageDep('child1', '1.0', 'has'); $pf3 = new PEAR_PackageFile_v2; $pf3->setPackage('child1'); $pf3->setChannel('pear.php.net'); $pf3->addPackageDepWithChannel('required', 'nodeps', 'pear.php.net'); $pf3->addPackageDepWithChannel('required', 'child2', 'pear.php.net'); $pf4 = new PEAR_PackageFile_v1; $pf4->setPackage('child2'); $pf4->addPackageDep('nodeps', '', 'has'); $pf5 = new PEAR_PackageFile_v1; $pf5->setPackage('nodeps'); $dl = &newDownloader(array()); require_once 'PEAR/Downloader/Package.php'; $p1 = new PEAR_Downloader_Package($dl); $p1->setPackageFile($pf1); $p2 = new PEAR_Downloader_Package($dl); $p2->setPackageFile($pf2); $p3 = new PEAR_Downloader_Package($dl); $p3->setPackageFile($pf3); $p4 = new PEAR_Downloader_Package($dl); $p4->setPackageFile($pf4); $p5 = new PEAR_Downloader_Package($dl); $p5->setPackageFile($pf5); $params = array(&$p1, &$p2, &$p3, &$p4, &$p5); $dl->sortPackagesForInstall($params); $phpunit->assertEquals('nodeps', $params[0]->getPackage(), 'nodeps'); $phpunit->assertEquals('child2', $params[1]->getPackage(), 'child2'); $phpunit->assertEquals('child1', $params[2]->getPackage(), 'child1'); $phpunit->assertEquals('indirect', $params[3]->getPackage(), 'indirect'); $phpunit->assertEquals('uberparent', $params[4]->getPackage(), 'uberparent'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion1.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion1.phpt +++ pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion1.phpt --TEST-- PEAR_Downloader->sortPackagesForInstall() recursion (simple) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; $pf1 = new PEAR_PackageFile_v2; $pf1->setPackage('uberparent'); $pf1->setChannel('pear.php.net'); $pf1->addPackageDepWithChannel('required', 'indirect', 'pear.php.net'); $pf2 = new PEAR_PackageFile_v1; $pf2->setPackage('indirect'); $pf2->addPackageDep('uberparent', '1.0', 'has'); $dl = &newDownloader(array()); require_once 'PEAR/Downloader/Package.php'; $p1 = new PEAR_Downloader_Package($dl); $p1->setPackageFile($pf1); $p2 = new PEAR_Downloader_Package($dl); $p2->setPackageFile($pf2); $params = array(&$p1, &$p2); $dl->sortPackagesForInstall($params); $phpunit->assertEquals('uberparent', $params[0]->getPackage(), 'uberparent'); $phpunit->assertEquals('indirect', $params[1]->getPackage(), 'indirect'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion2.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion2.phpt +++ pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion2.phpt --TEST-- PEAR_Downloader->sortPackagesForInstall() recursion (deep) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; $pf1 = new PEAR_PackageFile_v2; $pf1->setPackage('uberparent'); $pf1->setChannel('pear.php.net'); $pf1->addPackageDepWithChannel('required', 'indirect', 'pear.php.net'); $pf2 = new PEAR_PackageFile_v1; $pf2->setPackage('indirect'); $pf2->addPackageDep('sneaky', '1.0', 'has'); $pf3 = new PEAR_PackageFile_v1; $pf3->setPackage('sneaky'); $pf3->addPackageDep('uberparent', '1.0', 'has'); $dl = &newDownloader(array()); require_once 'PEAR/Downloader/Package.php'; $p1 = new PEAR_Downloader_Package($dl); $p1->setPackageFile($pf1); $p2 = new PEAR_Downloader_Package($dl); $p2->setPackageFile($pf2); $p3 = new PEAR_Downloader_Package($dl); $p3->setPackageFile($pf3); $params = array(&$p1, &$p2, &$p3); $dl->sortPackagesForInstall($params); $phpunit->assertEquals('uberparent', $params[0]->getPackage(), 'uberparent'); $phpunit->assertEquals('indirect', $params[1]->getPackage(), 'indirect'); $phpunit->assertEquals('sneaky', $params[2]->getPackage(), 'indirect'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v1/test_dependsOn.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_PackageFile/v1/test_dependsOn.phpt +++ pear-core/tests/PEAR_PackageFile/v1/test_dependsOn.phpt --TEST-- PEAR_PackageFile_Parser_v1->dependsOn() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $pf = new PEAR_PackageFile_v1; $pf->addPackageDep('test', '1.0', 'ge'); $phpunit->assertTrue($pf->dependsOn('TesT', 'pear.php.net'), 'first test'); $phpunit->assertFalse($pf->dependsOn('TesT', 'pear.poop.net'), 'second test'); $phpunit->assertFalse($pf->dependsOn('foo', 'pear.php.net'), 'last test'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v2/setup.php.inc?r=1.1&p=1 Index: pear-core/tests/PEAR_PackageFile/v2/setup.php.inc +++ pear-core/tests/PEAR_PackageFile/v2/setup.php.inc <?php require_once 'PEAR/PackageFile/Parser/v2.php'; require_once 'PEAR/PackageFile/v2.php'; require_once 'PEAR/Config.php'; function cleanall($dir = null) { if ($dir !== null) { $statedir = $dir; } else { $statedir = $GLOBALS['statedir']; } if (file_exists($statedir)) { $dp = opendir($statedir); while ($ent = readdir($dp)) { if (in_array($ent, array('.', '..'))) { continue; } if (is_dir($statedir . DIRECTORY_SEPARATOR . $ent)) { cleanall($statedir . DIRECTORY_SEPARATOR . $ent); continue; } unlink($statedir . DIRECTORY_SEPARATOR . $ent); } closedir($dp); rmdir($statedir); } } register_shutdown_function('cleanall'); $statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'registry_tester'; cleanall($statedir); mkdir($statedir); $config = serialize( array( 'php_dir' => $statedir . DIRECTORY_SEPARATOR . 'php', ) ); $fp = fopen($statedir . DIRECTORY_SEPARATOR . 'pear.ini', 'wb'); fwrite($fp, $config, strlen($config)); fclose($fp); $config = &new PEAR_Config($statedir . DIRECTORY_SEPARATOR . 'pear.ini'); $parser = new PEAR_PackageFile_Parser_v2; $parser->setConfig($config); require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = &new PEAR_PHPTest(true); class fake_log { var $_log = array(); function log($level, $message) { $this->_log[] = array($level, $message); } function getLog() { $log = $this->_log; $this->_log = array(); return $log; } } $fakelog = new fake_log; $parser->setLogger($fakelog); ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v2/test_dependsOn.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_PackageFile/v2/test_dependsOn.phpt +++ pear-core/tests/PEAR_PackageFile/v2/test_dependsOn.phpt --TEST-- PEAR_PackageFile_Parser_v2->dependsOn() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $pf = new PEAR_PackageFile_v2; $pf->addPackageDepWithChannel('required', 'test', 'pear.php.net'); $pf->addPackageDepWithChannel('required', 'PEAR_Server', 'pear.chiaraquartet.net'); $phpunit->assertTrue($pf->dependsOn('TesT', 'pear.php.net'), 'first test'); $phpunit->assertFalse($pf->dependsOn('TesT', 'pear.poop.net'), 'poop'); $phpunit->assertFalse($pf->dependsOn('foo', 'pear.php.net'), 'foo'); $phpunit->assertTrue($pf->dependsOn('pear_server', 'pear.chiaraquartet.net'), 'pear_server'); echo 'tests done'; ?> --EXPECT-- tests done
http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/setup.php.inc?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/setup.php.inc +++ pear-core/tests/PEAR_Downloader/setup.php.inc <?php $server = 'pear.Chiara'; //$server = 'test.pear.php.net'; $temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'; function cleanall($dir = null) { if ($dir !== null) { $statedir = $dir; } else { $statedir = $GLOBALS['temp_path']; } if (file_exists($statedir)) { $dp = opendir($statedir); while ($ent = readdir($dp)) { if (in_array($ent, array('.', '..'))) { continue; } if (is_dir($statedir . DIRECTORY_SEPARATOR . $ent)) { cleanall($statedir . DIRECTORY_SEPARATOR . $ent); continue; } unlink($statedir . DIRECTORY_SEPARATOR . $ent); } closedir($dp); rmdir($statedir); } } register_shutdown_function('cleanall'); cleanall($temp_path); if (!is_dir($temp_path)) { mkdir($temp_path); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'php')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'php'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'data')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'data'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'doc')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'test')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'test'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'ext')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'script')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'script'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'tmp')) { mkdir($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', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/Downloader.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = &new PEAR_PHPTest(true); class fake_log { var $_log = array(); function log($level, $message) { $this->_log[] = array($level, $message); } function getLog() { $log = $this->_log; $this->_log = array(); return $log; } } $fakelog = new fake_log; $config = &new PEAR_Config($temp_path . '/pear.ini'); function &newDownloader($options) { global $config; $downloader = &new test_PEAR_Downloader($fakelog, $options, $config); return $downloader; } ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall.phpt +++ pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall.phpt --TEST-- PEAR_Downloader->sortPackagesForInstall() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; $pf1 = new PEAR_PackageFile_v2; $pf1->setPackage('uberparent'); $pf1->setChannel('pear.poop.net'); $pf1->addPackageDepWithChannel('required', 'indirect', 'pear.php.net'); $pf2 = new PEAR_PackageFile_v1; $pf2->setPackage('indirect'); $pf2->addPackageDep('child1', '1.0', 'has'); $pf3 = new PEAR_PackageFile_v2; $pf3->setPackage('child1'); $pf3->setChannel('pear.php.net'); $pf3->addPackageDepWithChannel('required', 'nodeps', 'pear.php.net'); $pf3->addPackageDepWithChannel('required', 'child2', 'pear.php.net'); $pf4 = new PEAR_PackageFile_v1; $pf4->setPackage('child2'); $pf4->addPackageDep('nodeps', '', 'has'); $pf5 = new PEAR_PackageFile_v1; $pf5->setPackage('nodeps'); $dl = &newDownloader(array()); require_once 'PEAR/Downloader/Package.php'; $p1 = new PEAR_Downloader_Package($dl); $p1->setPackageFile($pf1); $p2 = new PEAR_Downloader_Package($dl); $p2->setPackageFile($pf2); $p3 = new PEAR_Downloader_Package($dl); $p3->setPackageFile($pf3); $p4 = new PEAR_Downloader_Package($dl); $p4->setPackageFile($pf4); $p5 = new PEAR_Downloader_Package($dl); $p5->setPackageFile($pf5); $params = array(&$p1, &$p2, &$p3, &$p4, &$p5); $dl->sortPackagesForInstall($params); $phpunit->assertEquals('nodeps', $params[0]->getPackage(), 'nodeps'); $phpunit->assertEquals('child2', $params[1]->getPackage(), 'child2'); $phpunit->assertEquals('child1', $params[2]->getPackage(), 'child1'); $phpunit->assertEquals('indirect', $params[3]->getPackage(), 'indirect'); $phpunit->assertEquals('uberparent', $params[4]->getPackage(), 'uberparent'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion1.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion1.phpt +++ pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion1.phpt --TEST-- PEAR_Downloader->sortPackagesForInstall() recursion (simple) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; $pf1 = new PEAR_PackageFile_v2; $pf1->setPackage('uberparent'); $pf1->setChannel('pear.php.net'); $pf1->addPackageDepWithChannel('required', 'indirect', 'pear.php.net'); $pf2 = new PEAR_PackageFile_v1; $pf2->setPackage('indirect'); $pf2->addPackageDep('uberparent', '1.0', 'has'); $dl = &newDownloader(array()); require_once 'PEAR/Downloader/Package.php'; $p1 = new PEAR_Downloader_Package($dl); $p1->setPackageFile($pf1); $p2 = new PEAR_Downloader_Package($dl); $p2->setPackageFile($pf2); $params = array(&$p1, &$p2); $dl->sortPackagesForInstall($params); $phpunit->assertEquals('uberparent', $params[0]->getPackage(), 'uberparent'); $phpunit->assertEquals('indirect', $params[1]->getPackage(), 'indirect'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion2.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion2.phpt +++ pear-core/tests/PEAR_Downloader/test_sortPackagesForInstall_recursion2.phpt --TEST-- PEAR_Downloader->sortPackagesForInstall() recursion (deep) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; $pf1 = new PEAR_PackageFile_v2; $pf1->setPackage('uberparent'); $pf1->setChannel('pear.php.net'); $pf1->addPackageDepWithChannel('required', 'indirect', 'pear.php.net'); $pf2 = new PEAR_PackageFile_v1; $pf2->setPackage('indirect'); $pf2->addPackageDep('sneaky', '1.0', 'has'); $pf3 = new PEAR_PackageFile_v1; $pf3->setPackage('sneaky'); $pf3->addPackageDep('uberparent', '1.0', 'has'); $dl = &newDownloader(array()); require_once 'PEAR/Downloader/Package.php'; $p1 = new PEAR_Downloader_Package($dl); $p1->setPackageFile($pf1); $p2 = new PEAR_Downloader_Package($dl); $p2->setPackageFile($pf2); $p3 = new PEAR_Downloader_Package($dl); $p3->setPackageFile($pf3); $params = array(&$p1, &$p2, &$p3); $dl->sortPackagesForInstall($params); $phpunit->assertEquals('uberparent', $params[0]->getPackage(), 'uberparent'); $phpunit->assertEquals('indirect', $params[1]->getPackage(), 'indirect'); $phpunit->assertEquals('sneaky', $params[2]->getPackage(), 'indirect'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v1/test_dependsOn.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_PackageFile/v1/test_dependsOn.phpt +++ pear-core/tests/PEAR_PackageFile/v1/test_dependsOn.phpt --TEST-- PEAR_PackageFile_Parser_v1->dependsOn() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $pf = new PEAR_PackageFile_v1; $pf->addPackageDep('test', '1.0', 'ge'); $phpunit->assertTrue($pf->dependsOn('TesT', 'pear.php.net'), 'first test'); $phpunit->assertFalse($pf->dependsOn('TesT', 'pear.poop.net'), 'second test'); $phpunit->assertFalse($pf->dependsOn('foo', 'pear.php.net'), 'last test'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v2/setup.php.inc?r=1.1&p=1 Index: pear-core/tests/PEAR_PackageFile/v2/setup.php.inc +++ pear-core/tests/PEAR_PackageFile/v2/setup.php.inc <?php require_once 'PEAR/PackageFile/Parser/v2.php'; require_once 'PEAR/PackageFile/v2.php'; require_once 'PEAR/Config.php'; function cleanall($dir = null) { if ($dir !== null) { $statedir = $dir; } else { $statedir = $GLOBALS['statedir']; } if (file_exists($statedir)) { $dp = opendir($statedir); while ($ent = readdir($dp)) { if (in_array($ent, array('.', '..'))) { continue; } if (is_dir($statedir . DIRECTORY_SEPARATOR . $ent)) { cleanall($statedir . DIRECTORY_SEPARATOR . $ent); continue; } unlink($statedir . DIRECTORY_SEPARATOR . $ent); } closedir($dp); rmdir($statedir); } } register_shutdown_function('cleanall'); $statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'registry_tester'; cleanall($statedir); mkdir($statedir); $config = serialize( array( 'php_dir' => $statedir . DIRECTORY_SEPARATOR . 'php', ) ); $fp = fopen($statedir . DIRECTORY_SEPARATOR . 'pear.ini', 'wb'); fwrite($fp, $config, strlen($config)); fclose($fp); $config = &new PEAR_Config($statedir . DIRECTORY_SEPARATOR . 'pear.ini'); $parser = new PEAR_PackageFile_Parser_v2; $parser->setConfig($config); require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = &new PEAR_PHPTest(true); class fake_log { var $_log = array(); function log($level, $message) { $this->_log[] = array($level, $message); } function getLog() { $log = $this->_log; $this->_log = array(); return $log; } } $fakelog = new fake_log; $parser->setLogger($fakelog); ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v2/test_dependsOn.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_PackageFile/v2/test_dependsOn.phpt +++ pear-core/tests/PEAR_PackageFile/v2/test_dependsOn.phpt --TEST-- PEAR_PackageFile_Parser_v2->dependsOn() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $pf = new PEAR_PackageFile_v2; $pf->addPackageDepWithChannel('required', 'test', 'pear.php.net'); $pf->addPackageDepWithChannel('required', 'PEAR_Server', 'pear.chiaraquartet.net'); $phpunit->assertTrue($pf->dependsOn('TesT', 'pear.php.net'), 'first test'); $phpunit->assertFalse($pf->dependsOn('TesT', 'pear.poop.net'), 'poop'); $phpunit->assertFalse($pf->dependsOn('foo', 'pear.php.net'), 'foo'); $phpunit->assertTrue($pf->dependsOn('pear_server', 'pear.chiaraquartet.net'), 'pear_server'); echo 'tests done'; ?> --EXPECT-- tests done