diff options
Diffstat (limited to 'pear/tests')
-rw-r--r-- | pear/tests/merge.input | 1 | ||||
-rw-r--r-- | pear/tests/pear1.phpt | 88 | ||||
-rw-r--r-- | pear/tests/pear2.phpt | 848 | ||||
-rw-r--r-- | pear/tests/pear_autoloader.phpt | 81 | ||||
-rw-r--r-- | pear/tests/pear_config.phpt | 289 | ||||
-rw-r--r-- | pear/tests/pear_error.phpt | 154 | ||||
-rw-r--r-- | pear/tests/pear_error2.phpt | 25 | ||||
-rw-r--r-- | pear/tests/pear_error3.phpt | 54 | ||||
-rw-r--r-- | pear/tests/pear_error4.phpt | 104 | ||||
-rw-r--r-- | pear/tests/pear_installer1.phpt | 91 | ||||
-rw-r--r-- | pear/tests/pear_installer2.phpt | 387 | ||||
-rw-r--r-- | pear/tests/pear_installer3.phpt | 413 | ||||
-rw-r--r-- | pear/tests/pear_registry.phpt | 168 | ||||
-rw-r--r-- | pear/tests/pear_system.phpt | 101 | ||||
-rw-r--r-- | pear/tests/php.ini | 2 | ||||
-rw-r--r-- | pear/tests/system.input | 1 | ||||
-rw-r--r-- | pear/tests/toonew.conf | 2 | ||||
-rw-r--r-- | pear/tests/user.input | 0 | ||||
-rw-r--r-- | pear/tests/user2.input | 1 |
19 files changed, 0 insertions, 2810 deletions
diff --git a/pear/tests/merge.input b/pear/tests/merge.input deleted file mode 100644 index 440106ea45..0000000000 --- a/pear/tests/merge.input +++ /dev/null @@ -1 +0,0 @@ -a:1:{s:7:"verbose";i:100;}
\ No newline at end of file diff --git a/pear/tests/pear1.phpt b/pear/tests/pear1.phpt deleted file mode 100644 index 2961ff7284..0000000000 --- a/pear/tests/pear1.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -PEAR constructor/destructor test ---SKIPIF-- -skip ---FILE-- -<?php - -require_once "PEAR.php"; - -class TestPEAR extends PEAR { - function TestPEAR($name) { - $this->_debug = true; - $this->name = $name; - $this->PEAR(); - } - function _TestPEAR() { - print "This is the TestPEAR($this->name) destructor\n"; - $this->_PEAR(); - } -} - -class Test2 extends PEAR { - function _Test2() { - print "This is the Test2 destructor\n"; - $this->_PEAR(); - } -} - -class Test3 extends Test2 { -} - -// test for bug http://bugs.php.net/bug.php?id=14744 -class Other extends Pear { - - var $a = 'default value'; - - function Other() { - $this->PEAR(); - } - - function _Other() { - // $a was modified but here misteriously returns to be - // the original value. That makes the destructor useless - // The correct value for $a in the destructor shoud be "new value" - echo "#bug 14744# Other class destructor: other->a == '" . $this->a ."'\n"; - } -} - -print "testing plain destructors\n"; -$o = new TestPEAR("test1"); -$p = new TestPEAR("test2"); -print "..\n"; -print "testing inherited destructors\n"; -$q = new Test3; - -echo "...\ntesting bug #14744\n"; -$other =& new Other; -echo "#bug 14744# Other class constructor: other->a == '" . $other->a ."'\n"; -// Modify $a -$other->a = 'new value'; -echo "#bug 14744# Other class modified: other->a == '" . $other->a ."'\n"; - -print "..\n"; -print "script exiting...\n"; -print "..\n"; - -?> ---GET-- ---POST-- ---EXPECT-- -testing plain destructors -PEAR constructor called, class=testpear -PEAR constructor called, class=testpear -.. -testing inherited destructors -... -testing bug #14744 -#bug 14744# Other class constructor: other->a == 'default value' -#bug 14744# Other class modified: other->a == 'new value' -.. -script exiting... -.. -This is the TestPEAR(test1) destructor -PEAR destructor called, class=testpear -This is the TestPEAR(test2) destructor -PEAR destructor called, class=testpear -This is the Test2 destructor -#bug 14744# Other class destructor: other->a == 'new value' diff --git a/pear/tests/pear2.phpt b/pear/tests/pear2.phpt deleted file mode 100644 index d5fc9770df..0000000000 --- a/pear/tests/pear2.phpt +++ /dev/null @@ -1,848 +0,0 @@ ---TEST-- -PEAR complete set/push/pop error-handling test (run from pear/tests dir) ---SKIPIF-- -skip ---FILE-- -<?php - -require_once "../PEAR.php"; - -class testErrorHandlingStatic { - function doSetErrorHandlingFunction() - { - print "testing in class setErrorHandling\n"; - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); - echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - } - - function doSetErrorHandlingStatic() - { - print "testing in class setErrorHandling array(obj, method)\n"; - $obj = new testErrorHandlingPEAR; - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); - echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - } - - function doSetErrorHandlingObject() - { - print "testing in class setErrorHandling array(class, method)\n"; - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); - echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - } - - function doPushErrorHandlingFunction() - { - print "testing in class pushErrorHandling\n"; - PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function doPushErrorHandlingObject() - { - print "testing in class pushErrorHandling array(obj, method)\n"; - $obj = new testErrorHandlingPEAR; - PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function doPushErrorHandlingStatic() - { - print "testing in class pushErrorHandling array(class, method)\n"; - PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function doPopErrorHandling() - { - print "testing in class popErrorHandling\n"; - PEAR::popErrorHandling(); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function fakeHandleError($err) - { - } -} - -class testErrorHandlingPEAR extends PEAR { - - function fakeHandleError($err) - { - } - - function doSetErrorHandlingFunction() - { - print "testing in PEAR setErrorHandling\n"; - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); - echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - echoPEARVars('$this->_default_error_mode', $this->_default_error_mode, - '$this->_default_error_options', $this->_default_error_options); - } - - function doSetErrorHandlingStatic() - { - print "testing in PEAR setErrorHandling array(obj, method)\n"; - $obj = new testErrorHandlingPEAR; - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); - echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - echoPEARVars('$this->_default_error_mode', $this->_default_error_mode, - '$this->_default_error_options', $this->_default_error_options); - } - - function doSetErrorHandlingObject() - { - print "testing in PEAR setErrorHandling array(class, method)\n"; - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); - echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - echoPEARVars('$this->_default_error_mode', $this->_default_error_mode, - '$this->_default_error_options', $this->_default_error_options); - } - - function doPushErrorHandlingFunction() - { - print "testing in PEAR pushErrorHandling\n"; - PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function doPushErrorHandlingObject() - { - print "testing in PEAR pushErrorHandling array(obj, method)\n"; - $obj = new testErrorHandlingPEAR; - PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function doPushErrorHandlingStatic() - { - print "testing in PEAR pushErrorHandling array(class, method)\n"; - PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } - - function doPopErrorHandling() - { - print "testing in PEAR popErrorHandling\n"; - PEAR::popErrorHandling(); - echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - } -} - -function echoPEARVars($name1, $mode, $name2, $options, $indent = '') -{ - $levelMap = - array( - E_USER_NOTICE => 'E_USER_NOTICE', - E_USER_WARNING => 'E_USER_WARNING', - E_USER_ERROR => 'E_USER_ERROR', - ); - $pearLevelMap = - array( - PEAR_ERROR_RETURN =>'PEAR_ERROR_RETURN', - PEAR_ERROR_PRINT =>'PEAR_ERROR_PRINT', - PEAR_ERROR_TRIGGER =>'PEAR_ERROR_TRIGGER', - PEAR_ERROR_DIE =>'PEAR_ERROR_DIE', - PEAR_ERROR_CALLBACK =>'PEAR_ERROR_CALLBACK', - PEAR_ERROR_EXCEPTION =>'PEAR_ERROR_EXCEPTION', - ); - print $indent . "echoing PEAR error-handling Variables:\n"; - print "$indent--------------------------------------\n"; - print $indent . "$name1:\n"; - $levels = get_error_mode($mode); - print $indent; - foreach($levels as $level) { - print $pearLevelMap[$level] . ','; - } - print "\n"; - print $indent . "$name2:\n"; - if (is_string($options)) { - print $indent . 'Callback: ' . $options. "()\n"; - } elseif (is_array($options)) { - print $indent . 'Callback: '; - if (is_string($options[0])) { - print '(static) ' . $options[0] . '::'; - } else { - print get_class($options[0]) . '->'; - } - print $options[1] . "()\n"; - } else { - print $indent . $levelMap[$options] . "\n"; - } - print "$indent--------------------------------------\n"; -} - -function echoPEARStack($name, $stack) -{ - print "stack $name:\n"; - foreach ($stack as $i => $item) { - print "Index $i:\n"; - echoPEARVars('mode', $item[0], 'options', $item[1], ' '); - } -} - -function get_error_mode($err) -{ - $ret = array(); - $level = 0; - while($level < 7) { - $a = ($err >> $level++) & 1; - if ($a) { - $ret[] = 1 << ($level - 1); - } - } - return $ret; -} -print "testing static error-handling global code\n"; -echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); -print "testing setErrorHandling\n"; -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); -echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); -print "testing setErrorHandling array(obj, method)\n"; -$obj = new testErrorHandlingPEAR; -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); -echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); -print "testing setErrorHandling array(class, method)\n"; -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); -echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], - '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); - - -print "testing pushErrorHandling\n"; -PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); -echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); -print "testing pushErrorHandling array(obj, method)\n"; -$obj = new testErrorHandlingPEAR; -PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); -echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); -print "testing pushErrorHandling array(class, method)\n"; -PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); -echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); - - -print "testing popErrorHandling\n"; -PEAR::popErrorHandling(); -echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); -print "testing popErrorHandling\n"; -$obj = new testErrorHandlingPEAR; -PEAR::popErrorHandling(); -echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); -print "testing popErrorHandling\n"; -PEAR::popErrorHandling(); -echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); -print "*******************************************\n"; -print "testing static error-handling in-class code\n"; -print "*******************************************\n"; -PEAR::setErrorHandling(PEAR_ERROR_RETURN, E_USER_NOTICE); -$obj = new testErrorHandlingStatic; -$obj->doSetErrorHandlingFunction(); -$obj->doSetErrorHandlingStatic(); -$obj->doSetErrorHandlingObject(); -$obj->doPushErrorHandlingFunction(); -$obj->doPushErrorHandlingStatic(); -$obj->doPushErrorHandlingObject(); -$obj->doPopErrorHandling(); -$obj->doPopErrorHandling(); -$obj->doPopErrorHandling(); -print "*******************************************\n"; -print "testing non-static error-handling in-class code\n"; -print "*******************************************\n"; -PEAR::setErrorHandling(PEAR_ERROR_RETURN, E_USER_NOTICE); -$obj = new testErrorHandlingPEAR; -$obj->doSetErrorHandlingFunction(); -$obj->doSetErrorHandlingStatic(); -$obj->doSetErrorHandlingObject(); -$obj->doPushErrorHandlingFunction(); -$obj->doPushErrorHandlingStatic(); -$obj->doPushErrorHandlingObject(); -$obj->doPopErrorHandling(); -$obj->doPopErrorHandling(); -$obj->doPopErrorHandling(); - -?> ---GET-- ---POST-- ---EXPECT-- -testing static error-handling global code -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_RETURN, -_PEAR_default_error_options: -E_USER_NOTICE --------------------------------------- -testing setErrorHandling -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_CALLBACK, -_PEAR_default_error_options: -Callback: get_error_mode() --------------------------------------- -testing setErrorHandling array(obj, method) -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_CALLBACK, -_PEAR_default_error_options: -Callback: testerrorhandlingpear->fakeHandleError() --------------------------------------- -testing setErrorHandling array(class, method) -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_CALLBACK, -_PEAR_default_error_options: -Callback: (static) testErrorHandlingStatic::fakeHandleError() --------------------------------------- -testing pushErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -testing pushErrorHandling array(obj, method) -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: testerrorhandlingpear->fakeHandleError() - -------------------------------------- -testing pushErrorHandling array(class, method) -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: testerrorhandlingpear->fakeHandleError() - -------------------------------------- -Index 4: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: testerrorhandlingpear->fakeHandleError() - -------------------------------------- -Index 5: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -testing popErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: testerrorhandlingpear->fakeHandleError() - -------------------------------------- -testing popErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -testing popErrorHandling -stack _PEAR_error_handler_stack: -******************************************* -testing static error-handling in-class code -******************************************* -testing in class setErrorHandling -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_CALLBACK, -_PEAR_default_error_options: -Callback: get_error_mode() --------------------------------------- -testing in class setErrorHandling array(obj, method) -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_CALLBACK, -_PEAR_default_error_options: -Callback: testerrorhandlingpear->fakeHandleError() --------------------------------------- -testing in class setErrorHandling array(class, method) -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_CALLBACK, -_PEAR_default_error_options: -Callback: (static) testErrorHandlingStatic::fakeHandleError() --------------------------------------- -testing in class pushErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -testing in class pushErrorHandling array(class, method) -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -testing in class pushErrorHandling array(obj, method) -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 4: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 5: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: testerrorhandlingpear->fakeHandleError() - -------------------------------------- -testing in class popErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -testing in class popErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -testing in class popErrorHandling -stack _PEAR_error_handler_stack: -******************************************* -testing non-static error-handling in-class code -******************************************* -testing in PEAR setErrorHandling -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_RETURN, -_PEAR_default_error_options: -E_USER_NOTICE --------------------------------------- -echoing PEAR error-handling Variables: --------------------------------------- -$this->_default_error_mode: -PEAR_ERROR_CALLBACK, -$this->_default_error_options: -Callback: get_error_mode() --------------------------------------- -testing in PEAR setErrorHandling array(obj, method) -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_RETURN, -_PEAR_default_error_options: -E_USER_NOTICE --------------------------------------- -echoing PEAR error-handling Variables: --------------------------------------- -$this->_default_error_mode: -PEAR_ERROR_CALLBACK, -$this->_default_error_options: -Callback: testerrorhandlingpear->fakeHandleError() --------------------------------------- -testing in PEAR setErrorHandling array(class, method) -echoing PEAR error-handling Variables: --------------------------------------- -_PEAR_default_error_mode: -PEAR_ERROR_RETURN, -_PEAR_default_error_options: -E_USER_NOTICE --------------------------------------- -echoing PEAR error-handling Variables: --------------------------------------- -$this->_default_error_mode: -PEAR_ERROR_CALLBACK, -$this->_default_error_options: -Callback: (static) testErrorHandlingStatic::fakeHandleError() --------------------------------------- -testing in PEAR pushErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -testing in PEAR pushErrorHandling array(class, method) -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -testing in PEAR pushErrorHandling array(obj, method) -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 4: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 5: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: testerrorhandlingpear->fakeHandleError() - -------------------------------------- -testing in PEAR popErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 2: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -Index 3: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -testing in PEAR popErrorHandling -stack _PEAR_error_handler_stack: -Index 0: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: (static) testErrorHandlingStatic::fakeHandleError() - -------------------------------------- -Index 1: - echoing PEAR error-handling Variables: - -------------------------------------- - mode: - PEAR_ERROR_CALLBACK, - options: - Callback: get_error_mode() - -------------------------------------- -testing in PEAR popErrorHandling -stack _PEAR_error_handler_stack: diff --git a/pear/tests/pear_autoloader.phpt b/pear/tests/pear_autoloader.phpt deleted file mode 100644 index f25f4a4116..0000000000 --- a/pear/tests/pear_autoloader.phpt +++ /dev/null @@ -1,81 +0,0 @@ ---TEST-- -PEAR_Autoloader ---SKIPIF-- -skip -<?php /*if (!extension_loaded("overload")) die("skip\n"); */ ?> ---FILE-- -<?php - -include dirname(__FILE__)."/../PEAR/Autoloader.php"; - -class test1 extends PEAR_Autoloader { - function test1() { - $this->addAutoload(array( - 'testfunc1' => 'testclass1', - 'testfunca' => 'testclass1', - 'testfunc2' => 'testclass2', - 'testfuncb' => 'testclass2', - )); - } -} - -class testclass1 { - function testfunc1($a) { - print "testfunc1 arg=";var_dump($a); - return 1; - } - function testfunca($a) { - print "testfunca arg=";var_dump($a); - return 2; - } -} - -class testclass2 { - function testfunc2($b) { - print "testfunc2 arg=";var_dump($b); - return 3; - } - function testfuncb($b) { - print "testfuncb arg=";var_dump($b); - return 4; - } -} - -function dump($obj) { - print "mapped methods:"; - foreach ($obj->_method_map as $method => $object) { - print " $method"; - } - print "\n"; -} - -function call($msg, $retval) { - print "calling $msg returned $retval\n"; -} - -$obj = new test1; -dump($obj); -call("testfunc1", $obj->testfunc1(2)); -dump($obj); -call("testfunca", $obj->testfunca(2)); -dump($obj); -call("testfunc2", $obj->testfunc2(2)); -dump($obj); -call("testfuncb", $obj->testfuncb(2)); -dump($obj); - -?> ---EXPECT-- -mapped methods: -testfunc1 arg=int(2) -calling testfunc1 returned 1 -mapped methods: testfunc1 testfunca -testfunca arg=int(2) -calling testfunca returned 2 -mapped methods: testfunc1 testfunca -testfunc2 arg=int(2) -calling testfunc2 returned 3 -mapped methods: testfunc1 testfunca testfunc2 testfuncb -testfuncb arg=int(2) -calling testfuncb returned 4 -mapped methods: testfunc1 testfunca testfunc2 testfuncb diff --git a/pear/tests/pear_config.phpt b/pear/tests/pear_config.phpt deleted file mode 100644 index 7e125ac855..0000000000 --- a/pear/tests/pear_config.phpt +++ /dev/null @@ -1,289 +0,0 @@ ---TEST-- -PEAR_Config ---SKIPIF-- -skip ---FILE-- -<?php - -error_reporting(E_ALL); -chdir(dirname(__FILE__)); -include "../PEAR/Config.php"; -copy("system.input", "system.conf"); -copy("user.input", "user.conf"); -copy("user2.input", "user2.conf"); -copy("merge.input", "merge.conf"); -PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s\n"); - -print "\n#0 starting up\n"; -dump_files(); - -print "\n#1 testing: constructor\n"; -$config = new PEAR_Config("user.conf", "system.conf"); -dump_array("files", $config->files); - -print "\n#2 testing: singleton\n"; -$o1 = &PEAR_Config::singleton(); -$o1->blah = 'blah'; -$o2 = &PEAR_Config::singleton(); -var_dump($o1->blah); -@var_dump($o2->blah); - -print "\n#3 testing: readConfigFile\n"; -$config->readConfigFile("user2.conf", "user"); -dump_config($config); -$config->readConfigFile("user.conf"); -dump_config($config); - -print "\n#4 testing: mergeConfigFile\n"; -$config->readConfigFile("user2.conf"); -dump_config($config, "user"); -$config->mergeConfigFile("merge.conf", true); -dump_config($config, "user"); -$config->readConfigFile("user2.conf"); -$config->mergeConfigFile("merge.conf", false); -dump_config($config, "user"); -$config->readConfigFile("user.conf"); -dump_config($config, "user"); -$config->mergeConfigFile("merge.conf", true, "xyzzy"); - -print "\n#5 testing: config file version detection\n"; -$config->readConfigFile("user.conf", "user"); -$config->readConfigFile("toonew.conf", "user"); - -print "\n#6 testing: get/set/remove\n"; -var_dump($config->get("verbose")); -$config->set("verbose", 100, "system"); -var_dump($config->get("verbose")); -$config->set("verbose", 2, "user"); -var_dump($config->get("verbose")); -$config->set("verbose", 2, "system"); -$config->set("verbose", 50, "user"); -var_dump($config->get("verbose")); -$config->remove("verbose", "user"); -var_dump($config->get("verbose")); -$config->remove("verbose", "system"); -var_dump($config->get("verbose")); - -print "\n#7 testing: getType\n"; -var_dump($config->getType("__unknown__")); -var_dump($config->getType("verbose")); -var_dump($config->getType("master_server")); -var_dump($config->getType("ext_dir")); - -print "\n#8 testing: getDocs\n"; -print "master_server: " . $config->getDocs("master_server") . "\n"; - -print "\n#9 testing: getKeys\n"; -$keys = $config->getKeys(); -sort($keys); -print implode(" ", $keys) . "\n"; - -print "\n#10 testing: definedBy\n"; -var_dump($config->definedBy("verbose")); -$config->set("verbose", 6, "system"); -$config->set("verbose", 3, "user"); -var_dump($config->definedBy("verbose")); -$config->remove("verbose", "system"); -var_dump($config->definedBy("verbose")); -$config->set("verbose", 6, "system"); -$config->remove("verbose", "user"); -var_dump($config->definedBy("verbose")); -$config->remove("verbose", "system"); -var_dump($config->definedBy("verbose")); - -print "\n#11 testing: isDefined\n"; -var_dump($config->isDefined("php_dir")); -var_dump($config->isDefined("verbose")); -var_dump($config->isDefined("HTTP_GET_VARS")); -var_dump($config->isDefined("query")); - -print "\n#12 testing: getGroup\n"; -foreach ($keys as $key) { - print "$key: ".$config->getGroup($key)."\n"; -} - -print "\n#13 testing: getGroups\n"; -$groups = $config->getGroups(); -sort($groups); -print implode(", ", $groups) . "\n"; - -print "\n#14 testing: getGroupKeys\n"; -foreach ($groups as $group) { - $gk = $config->getGroupKeys($group); - sort($gk); - print "$group: " . implode(", ", $gk) . "\n"; -} - -print "\n#15 testing: getPrompt\n"; -foreach ($keys as $key) { - print "$key: ".$config->getPrompt($key)."\n"; -} - - -// - -print "done\n"; - -unlink("user.conf"); -unlink("user2.conf"); -unlink("system.conf"); -unlink("merge.conf"); - -// ------------------------------------------------------------------------- // - -function dump_file($file) -{ - print "..$file:"; - $data = PEAR_Config::_readConfigDataFrom($file); - if (empty($data)) { - print " <empty>\n"; - return; - } - foreach ($data as $k => $v) { - print " $k=\"$v\""; - } - print "\n"; -} - -function dump_files() { - dump_file("system.conf"); - dump_file("user.conf"); -} - -function dump_array($name, $arr) { - print "$name:"; - if (empty($arr)) { - print " <empty>"; - } else { - foreach ($arr as $k => $v) { - print " $k=\"$v\""; - } - } - print "\n"; -} - -function dump_config(&$obj, $layer = null) { - if ($layer !== null) { - dump_array($layer, $obj->configuration[$layer]); - return; - } - foreach ($obj->configuration as $layer => $data) { - if ($layer == "default") { - continue; - } - dump_array($layer, $data); - } -} - -?> ---EXPECT-- -#0 starting up -..system.conf: master_server="pear.php.net" -..user.conf: <empty> - -#1 testing: constructor -files: system="system.conf" user="user.conf" - -#2 testing: singleton -string(4) "blah" -string(4) "blah" - -#3 testing: readConfigFile -user: verbose="2" -system: master_server="pear.php.net" -user: <empty> -system: master_server="pear.php.net" - -#4 testing: mergeConfigFile -user: verbose="2" -user: verbose="100" -user: verbose="2" -user: <empty> -unknown config file type `xyzzy' - -#5 testing: config file version detection -toonew.conf: unknown version `2.0' - -#6 testing: get/set/remove -int(1) -int(100) -int(2) -int(50) -int(2) -int(1) - -#7 testing: getType -bool(false) -string(7) "integer" -string(6) "string" -string(9) "directory" - -#8 testing: getDocs -master_server: name of the main PEAR server - -#9 testing: getKeys -bin_dir cache_dir cache_ttl data_dir doc_dir ext_dir http_proxy master_server password php_dir preferred_state sig_bin sig_keydir sig_type test_dir umask username verbose - -#10 testing: definedBy -string(7) "default" -string(4) "user" -string(4) "user" -string(6) "system" -string(7) "default" - -#11 testing: isDefined -bool(true) -bool(true) -bool(false) -bool(false) - -#12 testing: getGroup -bin_dir: File Locations -cache_dir: File Locations (Advanced) -cache_ttl: Advanced -data_dir: File Locations (Advanced) -doc_dir: File Locations -ext_dir: File Locations -http_proxy: Internet Access -master_server: Internet Access -password: Maintainers -php_dir: File Locations -preferred_state: Advanced -sig_bin: Maintainers -sig_keydir: Maintainers -sig_type: Maintainers -test_dir: File Locations (Advanced) -umask: Advanced -username: Maintainers -verbose: Advanced - -#13 testing: getGroups -Advanced, File Locations, File Locations (Advanced), Internet Access, Maintainers - -#14 testing: getGroupKeys -Advanced: cache_ttl, preferred_state, umask, verbose -File Locations: bin_dir, doc_dir, ext_dir, php_dir -File Locations (Advanced): cache_dir, data_dir, test_dir -Internet Access: http_proxy, master_server -Maintainers: password, sig_bin, sig_keydir, sig_type, username - -#15 testing: getPrompt -bin_dir: PEAR executables directory -cache_dir: PEAR Installer cache directory -cache_ttl: Cache TimeToLive -data_dir: PEAR data directory -doc_dir: PEAR documentation directory -ext_dir: PHP extension directory -http_proxy: HTTP Proxy Server Address -master_server: PEAR server -password: PEAR password (for maintainers) -php_dir: PEAR directory -preferred_state: Preferred Package State -sig_bin: Signature Handling Program -sig_keydir: Signature Key Directory -sig_type: Package Signature Type -test_dir: PEAR test directory -umask: Unix file mask -username: PEAR username (for maintainers) -verbose: Debug Log Level -done diff --git a/pear/tests/pear_error.phpt b/pear/tests/pear_error.phpt deleted file mode 100644 index 51493633ea..0000000000 --- a/pear/tests/pear_error.phpt +++ /dev/null @@ -1,154 +0,0 @@ ---TEST-- -PEAR_Error: basic test ---SKIPIF-- -skip ---FILE-- -<?php // -*- PHP -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::isError static method - -include dirname(__FILE__)."/../PEAR.php"; - -function test_error_handler($errno, $errmsg, $file, $line, $vars) { - $errortype = array ( - 1 => "Error", - 2 => "Warning", - 4 => "Parsing Error", - 8 => "Notice", - 16 => "Core Error", - 32 => "Core Warning", - 64 => "Compile Error", - 128 => "Compile Warning", - 256 => "User Error", - 512 => "User Warning", - 1024=> "User Notice" - ); - if (preg_match('/^The call_user_method.. function is deprecated/', - $errmsg)) { - return; - } - $prefix = $errortype[$errno]; - $file = basename($file); - print "\n$prefix: $errmsg in $file on line XXX\n"; -} - -error_reporting(E_ALL); -set_error_handler("test_error_handler"); - -class Foo_Error extends PEAR_Error -{ - function Foo_Error($message = "unknown error", $code = null, - $mode = null, $options = null, $userinfo = null) - { - $this->PEAR_Error($message, $code, $mode, $options, $userinfo); - $this->error_message_prefix = 'Foo_Error prefix'; - } -} - -class Test1 extends PEAR { - function Test1() { - $this->PEAR("Foo_Error"); - } - function runtest() { - return $this->raiseError("test error"); - } -} - -function errorhandler(&$obj) { - print "errorhandler function called, obj=".$obj->toString()."\n"; -} - -class errorclass { - function errorhandler(&$obj) { - print "errorhandler method called, obj=".$obj->toString()."\n"; - } -} - -print "specify error class: "; -$obj = new Test1; -$err = $obj->runtest(); -print $err->toString() . "\n"; - -$eo = new errorclass; - -print "default PEAR_Error: "; -$err = new PEAR_Error; -print $err->toString() . "\n"; -print "Testing it: "; -var_dump(PEAR::isError($err)); -print "This is not an error: "; -$str = "not an error"; -var_dump(PEAR::isError($str)); - -print "Now trying a bunch of variations...\n"; - -print "different message: "; -$err = new PEAR_Error("test error"); -print $err->toString() . "\n"; - -print "different message,code: "; -$err = new PEAR_Error("test error", -42); -print $err->toString() . "\n"; - -print "mode=print: "; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT); -print $err->toString() . "\n"; - -print "mode=callback(function): "; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK, "errorhandler"); - -print "mode=callback(method): "; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK, - array(&$eo, "errorhandler")); - -print "mode=print&trigger: "; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT|PEAR_ERROR_TRIGGER); -print $err->toString() . "\n"; - -print "mode=trigger:"; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER); -print $err->toString() . "\n"; - -print "mode=trigger,level=notice:"; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_NOTICE); -print $err->toString() . "\n"; - -print "mode=trigger,level=warning:"; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_WARNING); -print $err->toString() . "\n"; - -print "mode=trigger,level=error:"; -$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_ERROR); -print $err->toString() . "\n"; - -?> ---GET-- ---POST-- ---EXPECT-- -specify error class: [foo_error: message="test error" code=0 mode=return level=notice prefix="Foo_Error prefix" info=""] -default PEAR_Error: [pear_error: message="unknown error" code=0 mode=return level=notice prefix="" info=""] -Testing it: bool(true) -This is not an error: bool(false) -Now trying a bunch of variations... -different message: [pear_error: message="test error" code=0 mode=return level=notice prefix="" info=""] -different message,code: [pear_error: message="test error" code=-42 mode=return level=notice prefix="" info=""] -mode=print: test error[pear_error: message="test error" code=-42 mode=print level=notice prefix="" info=""] -mode=callback(function): errorhandler function called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorhandler prefix="" info=""] -mode=callback(method): errorhandler method called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorclass::errorhandler prefix="" info=""] -mode=print&trigger: test error -User Notice: test error in PEAR.php on line XXX -[pear_error: message="test error" code=-42 mode=print|trigger level=notice prefix="" info=""] -mode=trigger: -User Notice: test error in PEAR.php on line XXX -[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" info=""] -mode=trigger,level=notice: -User Notice: test error in PEAR.php on line XXX -[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" info=""] -mode=trigger,level=warning: -User Warning: test error in PEAR.php on line XXX -[pear_error: message="test error" code=-42 mode=trigger level=warning prefix="" info=""] -mode=trigger,level=error: -User Error: test error in PEAR.php on line XXX -[pear_error: message="test error" code=-42 mode=trigger level=error prefix="" info=""] diff --git a/pear/tests/pear_error2.phpt b/pear/tests/pear_error2.phpt deleted file mode 100644 index 4ae1c4b701..0000000000 --- a/pear/tests/pear_error2.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -PEAR_Error: die mode ---SKIPIF-- -skip ---FILE-- -<?php // -*- C++ -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::isError static method -// testing PEAR_Error - -include dirname(__FILE__)."/../PEAR.php"; - -error_reporting(E_ALL); - -print "mode=die: "; -$err = new PEAR_Error("test error!!\n", -42, PEAR_ERROR_DIE); -print $err->toString() . "\n"; - -?> ---GET-- ---POST-- ---EXPECT-- -mode=die: test error!! diff --git a/pear/tests/pear_error3.phpt b/pear/tests/pear_error3.phpt deleted file mode 100644 index 4c89ae5a69..0000000000 --- a/pear/tests/pear_error3.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -PEAR_Error: default error handling ---SKIPIF-- -skip ---FILE-- -<?php // -*- PHP -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::setErrorHandling -// - PEAR::raiseError method - -include dirname(__FILE__)."/../PEAR.php"; - -error_reporting(E_ALL); - -function errorhandler($eobj) -{ - if (PEAR::isError($eobj)) { - print "errorhandler called with an error object.\n"; - print "error message: ".$eobj->getMessage()."\n"; - } else { - print "errorhandler called, but without an error object.\n"; - } -} - -// Test 1 -PEAR::setErrorHandling(PEAR_ERROR_PRINT, "OOPS: %s\n"); -$tmp = new PEAR; -$tmp->raiseError("error happens"); - -// Return PEAR to its original state -$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; -$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; -$GLOBALS['_PEAR_default_error_callback'] = ''; - -// Test 2 -$obj = new PEAR; -$obj->setErrorHandling(PEAR_ERROR_PRINT); -$obj->raiseError("error 1\n"); -$obj->setErrorHandling(null); -$obj->raiseError("error 2\n"); -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler"); -$obj->raiseError("error 3"); -$obj->setErrorHandling(PEAR_ERROR_PRINT); -$obj->raiseError("error 4\n"); - -?> ---EXPECT-- -OOPS: error happens -error 1 -errorhandler called with an error object. -error message: error 3 -error 4
\ No newline at end of file diff --git a/pear/tests/pear_error4.phpt b/pear/tests/pear_error4.phpt deleted file mode 100644 index 57f69359b8..0000000000 --- a/pear/tests/pear_error4.phpt +++ /dev/null @@ -1,104 +0,0 @@ ---TEST-- -PEAR_Error: expected errors ---SKIPIF-- -skip ---FILE-- -<?php // -*- PHP -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::expectError -// - PEAR::popExpect - -include dirname(__FILE__)."/../PEAR.php"; - -error_reporting(E_ALL); - -function errorhandler($eobj) -{ - if (PEAR::isError($eobj)) { - print "error: ".$eobj->getMessage()."\n"; - } else { - print "errorhandler called without error object\n"; - } -} - -$obj = new PEAR; -$obj->setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler"); - -print "subtest 1\n"; -$obj->expectError(1); -$obj->raiseError("1", 1); -$obj->popExpect(); -$obj->raiseError("2", 2); - -print "subtest 2\n"; -$obj->expectError(3); -$obj->expectError(2); -$obj->raiseError("3", 3); - -print "subtest 3\n"; -$obj->popExpect(); -$obj->raiseError("3", 3); -$obj->popExpect(); - -print "subtest 4\n"; -$obj->expectError(array(1,2,3,4,5)); -$obj->raiseError("0", 0); -$obj->raiseError("1", 1); -$obj->raiseError("2", 2); -$obj->raiseError("3", 3); -$obj->raiseError("4", 4); -$obj->raiseError("5", 5); -$obj->raiseError("6", 6); -$obj->raiseError("error"); -$obj->popExpect(); - -print "subtest 5\n"; -$obj->expectError("*"); -$obj->raiseError("42", 42); -$obj->raiseError("75", 75); -$obj->raiseError("13", 13); -$obj->popExpect(); - -print "subtest 6\n"; -$obj->expectError(); -$obj->raiseError("123", 123); -$obj->raiseError("456", 456); -$obj->raiseError("789", 789); -$obj->popExpect(); - -print "subtest 7\n"; -$obj->expectError("syntax error"); -$obj->raiseError("type mismatch"); -$obj->raiseError("syntax error"); -$obj->popExpect(); - -print "subtest 8\n"; -$obj->expectError(array(1, 2, 3)); -$obj->expectError(array(3, 4, 5)); -$obj->raiseError(4); -$obj->delExpect(2); -$obj->raiseError(3); -$obj->delExpect(1, 3, 4, 5); -$err = $obj->delExpect(2); - -?> ---EXPECT-- -subtest 1 -error: 2 -subtest 2 -error: 3 -subtest 3 -subtest 4 -error: 0 -error: 6 -error: error -subtest 5 -subtest 6 -subtest 7 -error: type mismatch -subtest 8 -error: 4 -error: 3 -error: The expected error you submitted does not exist diff --git a/pear/tests/pear_installer1.phpt b/pear/tests/pear_installer1.phpt deleted file mode 100644 index 65fd5536fc..0000000000 --- a/pear/tests/pear_installer1.phpt +++ /dev/null @@ -1,91 +0,0 @@ ---TEST-- -PEAR_Installer test #1 ---SKIPIF-- -skip ---FILE-- -<?php - -require_once "PEAR/Installer.php"; - -// no UI is needed for these tests -$ui = false; -$installer = new PEAR_Installer($ui); -echo "test extractDownloadFileName:\n"; -echo 'existing file: '; -echo $installer->extractDownloadFileName($temp_path . DIRECTORY_SEPARATOR . 'user.conf', - $ui); -var_dump($ui); -echo 'invalid match: '; -echo $installer->extractDownloadFileName('27', - $ui); -echo "\n"; -var_dump($ui); -echo 'valid match, no version: '; -echo $installer->extractDownloadFileName('Testpackage', $ui); -echo "\n"; -var_dump($ui); -echo 'invalid match, has invalid version: '; -echo $installer->extractDownloadFileName('Testpackage-##', $ui); -echo "\n"; -var_dump($ui); -echo 'valid match, has version: '; -echo $installer->extractDownloadFileName('Testpackage-1.2', $ui); -echo "\n"; -var_dump($ui); - -echo "\ntest checkDeps 1:\n"; -$fakerel = array('release_deps' => -array( - array( - 'type' => 'pkg', - 'rel '=> 'has', - 'name' => 'foo', - 'optional' => 'yes' - ), - array( - 'type' => 'pkg', - 'rel '=> 'ge', - 'version' => '1.6', - 'name' => 'bar', - ), -)); -$res = ''; -var_dump($installer->checkDeps($fakerel, $res)); -var_dump($res); -$fakerel = array('release_deps' => -array( - array( - 'type' => 'pkg', - 'rel '=> 'has', - 'name' => 'foo', - 'optional' => 'yes' - ), -)); -echo "\ntest checkDeps 2:\n"; -$res = ''; -var_dump($installer->checkDeps($fakerel, $res)); -var_dump($res); -?> ---GET-- ---POST-- ---EXPECT-- -test extractDownloadFileName: -existing file: c:\web pages\chiara\testinstallertemp\user.confbool(false) -invalid match: 27 -NULL -valid match, no version: Testpackage -NULL -invalid match, has invalid version: Testpackage-## -NULL -valid match, has version: Testpackage -string(3) "1.2" - -test checkDeps 1: -bool(true) -string(23) " -requires package `bar'" - -test checkDeps 2: -bool(false) -string(77) "Optional dependencies: -package `foo' is recommended to utilize some features." diff --git a/pear/tests/pear_installer2.phpt b/pear/tests/pear_installer2.phpt deleted file mode 100644 index 39cd9d9d4d..0000000000 --- a/pear/tests/pear_installer2.phpt +++ /dev/null @@ -1,387 +0,0 @@ ---TEST-- -PEAR_Installer test #2 ---SKIPIF-- -skip ---FILE-- -<?php -$temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'; -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'); -} -// make the fake configuration - we'll use one of these and it should work -$config = serialize(array('master_server' => 'pear.php.net', - '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/Installer.php"; - -// no UI is needed for these tests -$ui = false; -$installer = new PEAR_Installer($ui); -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -echo "test _installFile():\n"; -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php', 'w'); -fwrite($fp, 'a'); -fclose($fp); -// pretend we just parsed a package.xml -$installer->pkginfo = array('package' => 'Foo'); - -echo "install as role=\"php\":\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'php'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file ext/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "install as role=\"ext\":\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'ext'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file php/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'ext' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "install as role=\"data\":\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'data'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file data/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "install as role=\"doc\":\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'doc'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file doc/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'doc' . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "install as role=\"test\":\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'test'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "install as role=\"script\":\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -$installer->rollbackFileTransaction(); - -echo "install as invalid role=\"klingon\":\n"; -$err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'klingon'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()); -echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); -if (is_object($err)) { - echo 'message: ' . $err->getMessage() . "\n\n"; -} -echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "install non-existent file:\n"; -$err = $installer->_installFile('....php', array('role' => 'php'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()); -echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); -if (is_object($err)) { - echo 'message: ' . $err->getMessage() . "\n"; -} -echo 'file bin/.tmp....php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmp....php') ? "yes\n" : "no\n"); - -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php', 'w'); -fwrite($fp, '@TEST@ stuff'); -fclose($fp); - -echo "\ntest valid md5sum:\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', 'md5sum' => md5('@TEST@ stuff')), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -$installer->rollbackFileTransaction(); - -echo "test invalid md5sum:\n"; -$err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', 'md5sum' => md5('oops stuff')), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()); -echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); -if (is_object($err)) { - echo 'message: ' . $err->getMessage() . "\n"; -} -echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "test invalid md5sum with --force:\n"; -$err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', 'md5sum' => md5('oops stuff')), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array('force' => true)); -echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); -if (is_object($err)) { - echo 'message: ' . $err->getMessage() . "\n"; -} -echo 'file bin/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -define('PEARINSTALLERTEST2_FAKE_FOO_CONST', 'good'); -echo "\ntest replacements:\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'replacements' => array(array('type' => 'php-const', 'from' => '@TEST@', 'to' => 'PEARINSTALLERTEST2_FAKE_FOO_CONST'))), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo "==>test php-const replacement: equals 'good stuff'? => "; -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php'), ''); - echo "$a\n"; -} else { - echo "no! file installation failed\n"; -} -$installer->rollbackFileTransaction(); - -echo "==>test invalid php-const replacement:\n"; -$err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'replacements' => array(array('type' => 'php-const', 'from' => '@TEST@', 'to' => '%PEARINSTALLERTEST2_FAKE_FOO_CONST'))), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()); -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php'), ''); - echo "$a\n"; -} else { - echo "no! file installation failed\n"; -} - -$installer->rollbackFileTransaction(); - -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'replacements' => array(array('type' => 'pear-config', 'from' => '@TEST@', 'to' => 'master_server'))), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo "==>test pear-config replacement: equals 'pear.php.net stuff'? => "; -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php'), ''); - echo "$a\n"; -} else { - echo "no! file installation failed\n"; -} -$installer->rollbackFileTransaction(); - -echo "==>test invalid pear-config replacement\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'replacements' => array(array('type' => 'pear-config', 'from' => '@TEST@', 'to' => 'blahblahblah'))), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php'), ''); - echo "$a\n"; -} else { - echo "no! file installation failed\n"; -} -$installer->rollbackFileTransaction(); - -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'replacements' => array(array('type' => 'package-info', 'from' => '@TEST@', 'to' => 'package'))), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo "==>test package-info replacement: equals 'Foo stuff'? => "; -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php'), ''); - echo "$a\n"; -} else { - echo "no! file installation failed\n"; -} -$installer->rollbackFileTransaction(); - -echo "==>test invalid package-info replacement:\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'replacements' => array(array('type' => 'package-info', 'from' => '@TEST@', 'to' => 'gronk'))), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php'), ''); - echo "$a\n"; -} else { - echo "no! file installation failed\n"; -} -$installer->rollbackFileTransaction(); - -echo "\ntest install-as:\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'install-as' => 'foobar.php'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo "==>test install as 'foobar.php'. file exists? "; -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - '.tmpfoobar.php')) -{ - echo "yes\n"; -} else { - echo "no\n"; -} -$installer->rollbackFileTransaction(); - -echo "\ntest baseinstalldir:\n"; -var_dump($installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', - 'baseinstalldir' => 'Foo/Mine'), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array())); -echo "==>test baseinstalldir = 'Foo/Mine'. file exists? "; -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . 'Mine' . DIRECTORY_SEPARATOR . '.tmpinstaller2.phpt.testfile.php')) -{ - echo "yes\n"; -} else { - echo "no\n"; -} -$installer->rollbackFileTransaction(); - -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . 'Mine'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - 'Foo'); -unlink($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php'); -//cleanup -chdir($curdir); -unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); -unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'php'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'Foo'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'data'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'doc' . DIRECTORY_SEPARATOR . 'Foo'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'Foo'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'test'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'script'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'tmp'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin'); -rmdir($temp_path); -?> ---GET-- ---POST-- ---EXPECT-- -test _installFile(): -install as role="php": -int(1) -file ext/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="ext": -int(1) -file php/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="data": -int(1) -file data/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="doc": -int(1) -file doc/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="test": -int(1) -file test/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="script": -int(1) -file bin/.tmpinstaller2.phpt.testfile.php exists? => yes -install as invalid role="klingon": -returned PEAR_Error: yes -message: Invalid role `klingon' for file installer2.phpt.testfile.php - -file bin/.tmpinstaller2.phpt.testfile.php exists? => no -install non-existent file: -returned PEAR_Error: yes -message: file does not exist -file bin/.tmp....php exists? => no - -test valid md5sum: -int(1) -file bin/.tmpinstaller2.phpt.testfile.php exists? => yes -test invalid md5sum: -returned PEAR_Error: yes -message: bad md5sum for file c:\web pages\chiara\testinstallertemp\bin\installer2.phpt.testfile.php -file bin/.tmpinstaller2.phpt.testfile.php exists? => no -test invalid md5sum with --force: -warning : bad md5sum for file c:\web pages\chiara\testinstallertemp\bin\installer2.phpt.testfile.php -returned PEAR_Error: no -file bin/.tmpinstaller2.phpt.testfile.php exists? => yes - -test replacements: -int(1) -==>test php-const replacement: equals 'good stuff'? => good stuff -==>test invalid php-const replacement: -invalid php-const replacement: %PEARINSTALLERTEST2_FAKE_FOO_CONST -@TEST@ stuff -int(1) -==>test pear-config replacement: equals 'pear.php.net stuff'? => pear.php.net stuff -==>test invalid pear-config replacement -invalid pear-config replacement: blahblahblah -int(1) -@TEST@ stuff -int(1) -==>test package-info replacement: equals 'Foo stuff'? => Foo stuff -==>test invalid package-info replacement: -invalid package-info replacement: gronk -int(1) -@TEST@ stuff - -test install-as: -int(1) -==>test install as 'foobar.php'. file exists? yes - -test baseinstalldir: -int(1) -==>test baseinstalldir = 'Foo/Mine'. file exists? yes - diff --git a/pear/tests/pear_installer3.phpt b/pear/tests/pear_installer3.phpt deleted file mode 100644 index b1ca4cba9b..0000000000 --- a/pear/tests/pear_installer3.phpt +++ /dev/null @@ -1,413 +0,0 @@ ---TEST-- -PEAR_Installer test #3 File Transactions ---SKIPIF-- -skip ---FILE-- -<?php -$temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'; -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'); -} -// make the fake configuration - we'll use one of these and it should work -$config = serialize(array('master_server' => 'pear.php.net', - '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/Installer.php"; - -// no UI is needed for these tests -$ui = false; -$installer = new PEAR_Installer($ui); -$installer->debug = 2; // hack debugging in -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -echo "test addFileOperation():\n"; -echo "invalid input to addFileOperation():\n"; -$err = $installer->addFileOperation('rename', 2); -echo 'Returned PEAR_Error?'; -echo (get_class($err) == 'pear_error' ? " yes\n" : " no\n"); -if (get_class($err) == 'pear_error') { - echo $err->getMessage() . "\n"; -} -echo 'count($installer->file_operations) = '; -var_dump(count($installer->file_operations)); -echo "Do valid addFileOperation() delete\n"; -touch($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt'); -$installer->addFileOperation('delete', array($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt')); -echo 'count($installer->file_operations) = '; -var_dump(count($installer->file_operations)); - -echo "test valid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; -} - -echo "Do valid addFileOperation() rename\n"; -touch($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt'); -$installer->addFileOperation('rename', array($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt', $temp_path . - DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'renamed.phpt')); - -echo 'file renamed.phpt exists?'; -clearstatcache(); -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR - . 'renamed.phpt') ? " yes\n" : " no\n"); -echo "test valid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; -} -echo 'file renamed.phpt exists?'; -clearstatcache(); -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR - . 'renamed.phpt') ? " yes\n" : " no\n"); -unlink($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR - . 'renamed.phpt'); - -echo "Do valid addFileOperation() chmod\n"; -touch($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt'); -clearstatcache(); -$perms = fileperms($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt'); -// check to see if chmod works on this OS -chmod($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt', 0776); -clearstatcache(); -if (fileperms($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt') - == $perms && substr(PHP_OS, 0, 3) == 'WIN') { - // we are on windows, so skip this test, but simulate success -echo <<<EOF -file permissions are: 776 -test valid commitFileTransaction(): -about to commit 1 file operations -successfully committed 1 file operations -worked -file permissions are: 640 - -EOF; -} else { - $installer->addFileOperation('chmod', array(0640, $temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt')); - - echo 'file permissions are: ' . decoct(fileperms($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt')) . "\n"; - echo "test valid commitFileTransaction():\n"; - if ($installer->commitFileTransaction()) { - echo "worked\n"; - } else { - echo "didn't work!\n"; - } - echo 'file permissions are: ' . decoct(fileperms($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt')) . "\n"; -} -unlink($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR - . 'installertestfooblah.phpt'); - -mkdir($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR - . 'installertestfooblah'); -echo "Do valid addFileOperation() rmdir\n"; -echo 'directory exists?'; -clearstatcache(); -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah') ? " yes\n" : " no\n"); -$installer->addFileOperation('rmdir', array($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah')); - -echo "test valid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; -} -echo 'directory exists?'; - -clearstatcache(); -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . - 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah') ? " yes\n" : " no\n"); - -echo "Do valid addFileOperation() installed_as\n"; -$installer->addFileOperation('installed_as', array('test.php', - $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . - 'glomp' . DIRECTORY_SEPARATOR . 'fromp' . DIRECTORY_SEPARATOR - . 'installertestfooblah.phpt', - $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR, - 'glomp' . DIRECTORY_SEPARATOR . 'fromp')); -echo "test valid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; -} -if (isset($installer->pkginfo['filelist'])) { - echo "filelist created\n"; -} else { - echo "filelist not created!\n"; -} -if (isset($installer->pkginfo['filelist']['test.php'])) { - echo "filelist test.php created\n"; -} else { - echo "filelist test.php not created!\n"; -} -if (isset($installer->pkginfo['filelist']['test.php']['installed_as'])) { - echo "filelist test.php installed_as created\n"; -} else { - echo "filelist test.php installed_as not created!\n"; -} -$p = $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . - 'glomp' . DIRECTORY_SEPARATOR . 'fromp' . DIRECTORY_SEPARATOR - . 'installertestfooblah.phpt'; -if (@$installer->pkginfo['filelist']['test.php']['installed_as'] == $p) { - echo "filelist test.php installed_as is correct\n"; -} else { - echo "filelist test.php installed_as is not correct!\n"; -} -if (isset($installer->pkginfo['filelist']['dirtree'])) { - echo "filelist dirtree created\n"; -} else { - echo "filelist dirtree not created!\n"; -} -$p = $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . - 'glomp'; -if (isset($installer->pkginfo['filelist']['dirtree'][$p])) { - echo "filelist dirtree glomp created\n"; -} else { - echo "filelist dirtree glomp not created!\n"; -} -$p .= DIRECTORY_SEPARATOR . 'fromp'; -if (isset($installer->pkginfo['filelist']['dirtree'][$p])) { - echo "filelist dirtree fromp created\n"; -} else { - echo "filelist dirtree fromp not created!\n"; -} - -echo "Do valid addFileOperation() installed_as\n"; -$installer->addFileOperation('installed_as', array('test.php', - $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . - 'glomp' . DIRECTORY_SEPARATOR . 'fromp' . DIRECTORY_SEPARATOR - . 'installertestfooblah.phpt', - $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR, - 'glomp' . DIRECTORY_SEPARATOR . 'fromp')); -echo "test valid rollbackFileTransaction():\n"; -$installer->rollbackFileTransaction(); -if (isset($installer->pkginfo['filelist'])) { - echo "filelist created\n"; -} else { - echo "filelist not created!\n"; -} -if (isset($installer->pkginfo['filelist']['test.php'])) { - echo "filelist test.php created\n"; -} else { - echo "filelist test.php not created!\n"; -} -if (isset($installer->pkginfo['filelist']['test.php']['installed_as'])) { - echo "filelist test.php installed_as created\n"; -} else { - echo "filelist test.php installed_as not created!\n"; -} -$p = $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . - 'glomp' . DIRECTORY_SEPARATOR . 'fromp' . DIRECTORY_SEPARATOR - . 'installertestfooblah.phpt'; -if (@$installer->pkginfo['filelist']['test.php']['installed_as'] == $p) { - echo "filelist test.php installed_as is correct\n"; -} else { - echo "filelist test.php installed_as is not correct!\n"; -} -if (isset($installer->pkginfo['filelist']['dirtree'])) { - echo "filelist dirtree created\n"; -} else { - echo "filelist dirtree not created!\n"; -} -$p = $temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . - 'glomp'; -if (isset($installer->pkginfo['filelist']['dirtree'][$p])) { - echo "filelist dirtree glomp created\n"; -} else { - echo "filelist dirtree glomp not created!\n"; -} -$p .= DIRECTORY_SEPARATOR . 'fromp'; -if (isset($installer->pkginfo['filelist']['dirtree'][$p])) { - echo "filelist dirtree fromp created\n"; -} else { - echo "filelist dirtree fromp not created!\n"; -} - -// invalid tests -echo "\n==>Invalid tests\n"; -echo "Do valid addFileOperation() delete with non-existing file\n"; -$installer->addFileOperation('delete', array('gloober62456.phpt')); -echo 'count($installer->file_operations) = '; -var_dump(count($installer->file_operations)); - -echo "test invalid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; - $installer->rollbackFileTransaction(); -} - -echo "Do valid addFileOperation() rename with non-existing file\n"; -$installer->addFileOperation('rename', array('gloober62456.phpt', 'faber.com')); -echo 'count($installer->file_operations) = '; -var_dump(count($installer->file_operations)); - -echo "test invalid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; - $installer->rollbackFileTransaction(); -} - -echo "Do valid addFileOperation() chmod with non-existing file\n"; -$installer->addFileOperation('chmod', array(0640, 'faber.com')); -echo 'count($installer->file_operations) = '; -var_dump(count($installer->file_operations)); - -echo "test invalid commitFileTransaction():\n"; -if ($installer->commitFileTransaction()) { - echo "worked\n"; -} else { - echo "didn't work!\n"; - $installer->rollbackFileTransaction(); -} - -//cleanup -chdir($curdir); -unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); -unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'php'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'data'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'test'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'script'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'tmp'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin'); -rmdir($temp_path); -?> ---GET-- ---POST-- ---EXPECT-- -test addFileOperation(): -invalid input to addFileOperation(): -Returned PEAR_Error? yes -Internal Error: $data in addFileOperation must be an array, was integer -count($installer->file_operations) = int(0) -Do valid addFileOperation() delete -count($installer->file_operations) = int(1) -test valid commitFileTransaction(): -about to commit 1 file operations -successfully committed 1 file operations -worked -Do valid addFileOperation() rename -file renamed.phpt exists? no -test valid commitFileTransaction(): -about to commit 1 file operations -successfully committed 1 file operations -worked -file renamed.phpt exists? yes -Do valid addFileOperation() chmod -file permissions are: 776 -test valid commitFileTransaction(): -about to commit 1 file operations -successfully committed 1 file operations -worked -file permissions are: 640 -Do valid addFileOperation() rmdir -directory exists? yes -test valid commitFileTransaction(): -about to commit 1 file operations -successfully committed 1 file operations -worked -directory exists? no -Do valid addFileOperation() installed_as -test valid commitFileTransaction(): -about to commit 1 file operations -successfully committed 1 file operations -worked -filelist created -filelist test.php created -filelist test.php installed_as created -filelist test.php installed_as is correct -filelist dirtree created -filelist dirtree glomp created -filelist dirtree fromp created -Do valid addFileOperation() installed_as -test valid rollbackFileTransaction(): -rolling back 1 file operations -filelist created -filelist test.php created -filelist test.php installed_as not created! -filelist test.php installed_as is not correct! -filelist dirtree not created! -filelist dirtree glomp not created! -filelist dirtree fromp not created! - -==>Invalid tests -Do valid addFileOperation() delete with non-existing file -count($installer->file_operations) = int(1) -test invalid commitFileTransaction(): -about to commit 1 file operations -warning: file gloober62456.phpt doesn't exist, can't be deleted -successfully committed 1 file operations -worked -Do valid addFileOperation() rename with non-existing file -count($installer->file_operations) = int(1) -test invalid commitFileTransaction(): -about to commit 1 file operations -cannot rename file gloober62456.phpt, doesn't exist -didn't work! -rolling back 1 file operations -Do valid addFileOperation() chmod with non-existing file -count($installer->file_operations) = int(1) -test invalid commitFileTransaction(): -about to commit 1 file operations -permission denied (chmod): faber.com 640 -didn't work! -rolling back 1 file operations diff --git a/pear/tests/pear_registry.phpt b/pear/tests/pear_registry.phpt deleted file mode 100644 index 0295ed922e..0000000000 --- a/pear/tests/pear_registry.phpt +++ /dev/null @@ -1,168 +0,0 @@ ---TEST-- -PEAR_Registry ---SKIPIF-- -skip ---FILE-- -<?php - -error_reporting(E_ALL); -include dirname(__FILE__)."/../PEAR/Registry.php"; -PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n"); -cleanall(); - -$files1 = array( - "pkg1-1.php" => array( - "role" => "php", - ), - "pkg1-2.php" => array( - "role" => "php", - "baseinstalldir" => "pkg1", - ), - ); -$files2 = array( - "pkg2-1.php" => array( - "role" => "php", - ), - "pkg2-2.php" => array( - "role" => "php", - "baseinstalldir" => "pkg2", - ), - ); -$files3 = array( - "pkg3-1.php" => array( - "role" => "php", - ), - "pkg3-2.php" => array( - "role" => "php", - "baseinstalldir" => "pkg3", - ), - ); -$files3_new = array( - "pkg3-3.php" => array( - "role" => "php", - "baseinstalldir" => "pkg3", - ), - "pkg3-4.php" => array( - "role" => "php", - ), - ); - -print "creating registry object\n"; -$reg = new PEAR_Registry; -$reg->statedir = getcwd(); -dumpall($reg); - -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1)); -dumpall($reg); - -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2)); -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3)); -dumpall($reg); - -$reg->updatePackage("pkg2", array("version" => "2.1")); -dumpall($reg); - -var_dump($reg->deletePackage("pkg2")); -dumpall($reg); - -var_dump($reg->deletePackage("pkg2")); -dumpall($reg); - -$reg->updatePackage("pkg3", array("version" => "3.1b1", "status" => "beta")); -dumpall($reg); - -print_r($reg->checkFilemap(array_merge($files3, $files2))); - -$reg->updatePackage("pkg3", array("filelist" => $files3_new)); -dumpall($reg); - -print "tests done\n"; - -cleanall(); - -// ------------------------------------------------------------------------- // - -function cleanall() -{ - $dp = opendir("."); - while ($ent = readdir($dp)) { - if (substr($ent, -4) == ".reg") { - unlink($ent); - } - } -} - -function dumpall(&$reg) -{ - print "dumping registry...\n"; - $info = $reg->packageInfo(); - foreach ($info as $pkg) { - print $pkg["name"] . ":"; - unset($pkg["name"]); - foreach ($pkg as $k => $v) { - if ($k == '_lastmodified') continue; - if (is_array($v) && $k == 'filelist') { - print " $k=array("; - $i = 0; - foreach ($v as $k2 => $v2) { - if ($i++ > 0) print ","; - print "{$k2}["; - $j = 0; - foreach ($v2 as $k3 => $v3) { - if ($j++ > 0) print ","; - print "$k3=$v3"; - } - print "]"; - } - print ")"; - } else { - print " $k=\"$v\""; - } - } - print "\n"; - } - print "dump done\n"; -} - -?> ---EXPECT-- -creating registry object -dumping registry... -dump done -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -dump done -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg2: version="2.0" filelist=array(pkg2-1.php[role=php],pkg2-2.php[role=php,baseinstalldir=pkg2]) -pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) -dump done -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg2: version="2.1" filelist=array(pkg2-1.php[role=php],pkg2-2.php[role=php,baseinstalldir=pkg2]) -pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) -dump done -bool(true) -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) -dump done -bool(false) -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) -dump done -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg3: version="3.1b1" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) status="beta" -dump done -Array -( - [pkg3-1.php] => pkg3 - [pkg3/pkg3-2.php] => pkg3 -) -dumping registry... -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg3: version="3.1b1" filelist=array(pkg3-3.php[role=php,baseinstalldir=pkg3],pkg3-4.php[role=php]) status="beta" -dump done -tests done diff --git a/pear/tests/pear_system.phpt b/pear/tests/pear_system.phpt deleted file mode 100644 index 64f3d1143e..0000000000 --- a/pear/tests/pear_system.phpt +++ /dev/null @@ -1,101 +0,0 @@ ---TEST-- -System commands tests ---SKIPIF-- -skip ---FILE-- -<?php -error_reporting(E_ALL); -require_once 'System.php'; - -$sep = DIRECTORY_SEPARATOR; - -/******************* - mkDir -********************/ -// Single directory creation -System::mkDir('singledir'); -if( !is_dir('singledir') ){ - print "System::mkDir('singledir'); failed\n"; -} - -// Multiple directory creation -System::mkDir('dir1 dir2 dir3'); -if (!@is_dir('dir1') || !@is_dir('dir2') || !@is_dir('dir3')) { - print "System::mkDir('dir1 dir2 dir3'); failed\n"; -} - -// Parent creation without "-p" fail -if (@System::mkDir("dir4{$sep}dir3")) { - print "System::mkDir(\"dir4{$sep}dir3\") did not failed\n"; -} - -// Create a directory which is a file already fail -touch('file4'); -$res = @System::mkDir('file4 dir5'); -if ($res) { - print "System::mkDir('file4 dir5') did not failed\n"; -} -if (!@is_dir('dir5')) { - print "System::mkDir('file4 dir5') failed\n"; -} - -// Parent directory creation -System::mkDir("-p dir2{$sep}dir21 dir6{$sep}dir61{$sep}dir611"); -if (!@is_dir("dir2{$sep}dir21") || !@is_dir("dir6{$sep}dir61{$sep}dir611")) { - print "System::mkDir(\"-p dir2{$sep}dir21 dir6{$sep}dir61{$sep}dir611\")); failed\n"; -} - -/******************* - mkTemp -********************/ - -// Create a temporal file with "tst" as filename prefix -$tmpfile = System::mkTemp('tst'); -$tmpenv = System::tmpDir(); -if (!@is_file($tmpfile) || !ereg("^$tmpenv{$sep}tst", $tmpfile)) { - print "System::mkTemp('tst') failed\n"; -} - -// Create a temporal dir in "dir1" with default prefix "tmp" -$tmpdir = System::mkTemp('-d -t dir1'); -if (!@is_dir($tmpdir) || !ereg("^dir1{$sep}tmp", $tmpdir)) { - print "System::mkTemp('-d -t dir1') failed\n"; -} - -/******************* - rm -********************/ - -// Try to delete a dir without "-r" option -if (@System::rm('dir1')) { - print "System::rm('dir1') did not fail\n"; -} - -// Multiple and recursive delete -$del = "dir1 dir2 dir3 file4 dir5 dir6"; -if (!@System::rm("-r $del")) { - print "System::rm(\"-r $del\") failed\n"; -} - -/******************* - which -********************/ - -if (OS_UNIX) { - if (System::which('ls') != '/bin/ls') { - print "System::which('ls') failed\n"; - } - if (System::which('i_am_not_a_command')) { - print "System::which('i_am_not_a_command') did not failed\n"; - } -} // XXX Windows test - -/******************* - cat -********************/ -// Missing tests yet - -print "end\n"; -?> ---EXPECT-- -end diff --git a/pear/tests/php.ini b/pear/tests/php.ini deleted file mode 100644 index c75c9b4f11..0000000000 --- a/pear/tests/php.ini +++ /dev/null @@ -1,2 +0,0 @@ -; php.ini for PEAR tests -include_path=.. diff --git a/pear/tests/system.input b/pear/tests/system.input deleted file mode 100644 index 9c6bece157..0000000000 --- a/pear/tests/system.input +++ /dev/null @@ -1 +0,0 @@ -a:1:{s:13:"master_server";s:12:"pear.php.net";}
\ No newline at end of file diff --git a/pear/tests/toonew.conf b/pear/tests/toonew.conf deleted file mode 100644 index 6f0c72fe4b..0000000000 --- a/pear/tests/toonew.conf +++ /dev/null @@ -1,2 +0,0 @@ -#PEAR_Config 2.0 -master_server = pear.php.net diff --git a/pear/tests/user.input b/pear/tests/user.input deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/user.input +++ /dev/null diff --git a/pear/tests/user2.input b/pear/tests/user2.input deleted file mode 100644 index ac9a8afc0d..0000000000 --- a/pear/tests/user2.input +++ /dev/null @@ -1 +0,0 @@ -a:1:{s:7:"verbose";i:2;}
\ No newline at end of file |