diff options
Diffstat (limited to 'pear/tests')
96 files changed, 0 insertions, 17481 deletions
diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrorMessage.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrorMessage.php deleted file mode 100644 index e636886e3d..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrorMessage.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -class testgemessage -{ - function __toString() - { - return '__toString() called'; - } -} -class testgemessage1 {} -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_getErrorMessage extends PHPUnit_TestCase -{ - - function Error_Stack_TestCase_getErrorMessage($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack('test'); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function returnsignore($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_IGNORE; - } - - function test_basic() - { - if (!$this->_methodExists('getErrorMessage')) { - return; - } - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, - array('message' => 'boo', 'params' => array(), 'code' => 6)); - $this->assertEquals('boo', $msg); - } - - function test_basic_template() - { - if (!$this->_methodExists('getErrorMessage')) { - return; - } - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, - array('message' => 'boo', 'params' => array()), 'far%__msg%'); - $this->assertEquals('farboo', $msg); - } - - function test_basic_params() - { - if (!$this->_methodExists('getErrorMessage')) { - return; - } - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, array('message' => '', - 'params' => array('bar' => 'hello')), '%bar% foo'); - $this->assertEquals('hello foo', $msg, 'string'); - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, array('message' => '', - 'params' => array('bar' => array('hello', 'there'))), '%bar% foo'); - $this->assertEquals('hello, there foo', $msg, 'array'); - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, array('message' => '', - 'params' => array('bar' => new testgemessage)), '%bar% foo'); - $this->assertEquals('__toString() called foo', $msg, 'first object, __toString()'); - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, array('message' => '', - 'params' => array('bar' => new testgemessage1)), '%bar% foo'); - $this->assertEquals('Object foo', $msg, 'second object, no __toString()'); - $errs = PEAR_ErrorStack::staticGetErrors(); - unset($errs['PEAR_ErrorStack'][0]['context']); - unset($errs['PEAR_ErrorStack'][0]['time']); - $this->assertEquals( - array('PEAR_ErrorStack' => - array( - array( - 'code' => PEAR_ERRORSTACK_ERR_OBJTOSTRING, - 'params' => array('obj' => 'testgemessage1'), - 'package' => 'PEAR_ErrorStack', - 'level' => 'warning', - 'message' => 'object testgemessage1 passed into getErrorMessage, but has no __toString() method', - ))), $errs, 'warning not raised'); - } - - function test_basic_params_with_template() - { - if (!$this->_methodExists('getErrorMessage')) { - return; - } - $this->stack->setErrorMessageTemplate(array(6 => '%bar% foo')); - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, array('message' => '', - 'params' => array('bar' => 'hello'), 'code' => 6)); - $this->assertEquals('hello foo', $msg, 'string'); - $msg = PEAR_ErrorStack::getErrorMessage($this->stack, array('message' => '', - 'params' => array('bar' => 'hello'), 'code' => 7)); - $this->assertEquals('', $msg, 'string'); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrorMessageTemplate.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrorMessageTemplate.php deleted file mode 100644 index a1a39e4757..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrorMessageTemplate.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_getErrorMessageTemplate extends PHPUnit_TestCase -{ - - function Error_Stack_TestCase_getErrorMessageTemplate($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack('test'); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function returnsignore($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_IGNORE; - } - - function test_normal() - { - if (!$this->_methodExists('getErrorMessageTemplate')) { - return; - } - $this->assertEquals('%__msg%', $this->stack->getErrorMessageTemplate(23)); - } - - function test_normal_hascode() - { - if (!$this->_methodExists('getErrorMessageTemplate')) { - return; - } - if (!$this->_methodExists('setErrorMessageTemplate')) { - return; - } - $this->stack->setErrorMessageTemplate(array(23 => '%foo% has %__msg%')); - $this->assertEquals('%foo% has %__msg%', $this->stack->getErrorMessageTemplate(23)); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrors.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrors.php deleted file mode 100644 index 4207efa5f8..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_getErrors.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_getErrors extends PHPUnit_TestCase -{ - - function Error_Stack_TestCase_getErrors($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack('test'); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function returnsignore($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_IGNORE; - } - - function test_none() - { - if (!$this->_methodExists('getErrors')) { - return; - } - $this->assertEquals(array(), $this->stack->getErrors()); - $this->assertEquals(array(), $this->stack->getErrors(true)); - } - - function test_normal() - { - if (!$this->_methodExists('getErrors')) { - return; - } - $this->assertEquals(array(), $this->stack->getErrors()); - $this->stack->push(1); - $this->stack->push(2, 'warning'); - $this->stack->push(3, 'foo'); - $ret = $this->stack->getErrors(); - for ($i= 0; $i < 3; $i++) { - unset($ret[$i]['time']); - unset($ret[$i]['context']); - } - $this->assertEquals( - array( - array('code' => 3, - 'params' => array(), - 'package' => 'test', - 'level' => 'foo', - 'message' => ''), - array('code' => 2, - 'params' => array(), - 'package' => 'test', - 'level' => 'warning', - 'message' => ''), - array('code' => 1, - 'params' => array(), - 'package' => 'test', - 'level' => 'error', - 'message' => ''), - ), $ret, 'incorrect errors, non-purge'); - $ret = $this->stack->getErrors(true); - for ($i= 0; $i < 3; $i++) { - unset($ret[$i]['time']); - unset($ret[$i]['context']); - } - $this->assertEquals( - array( - array('code' => 3, - 'params' => array(), - 'package' => 'test', - 'level' => 'foo', - 'message' => ''), - array('code' => 2, - 'params' => array(), - 'package' => 'test', - 'level' => 'warning', - 'message' => ''), - array('code' => 1, - 'params' => array(), - 'package' => 'test', - 'level' => 'error', - 'message' => ''), - ), $ret, 'incorrect errors, purge'); - $this->assertEquals(array(), $this->stack->getErrors()); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpop.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpop.php deleted file mode 100644 index 2e029629a0..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpop.php +++ /dev/null @@ -1,367 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_pushpop extends PHPUnit_TestCase -{ - /** - * A PEAR_PackageFileManager object - * @var object - */ - var $packagexml; - - function Error_Stack_TestCase_pushpop($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack('test'); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function test_valid_basic() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack->push(1); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_params() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $z = $this->stack->push(2, 'exception', array('my' => 'param'), 'hello', - array('test'), array(array('file' => 'boof', 'line' => 34))); - $err = $this->stack->pop('exception'); - $this->assertEquals($z, $err, 'popped different error'); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 2, - 'params' => array('my' => 'param'), - 'package' => 'test', - 'message' => 'hello', - 'level' => 'exception', - 'context' => - array( - 'file' => 'boof', - 'line' => 34, - ), - 'repackage' => array('test'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_paramscompat() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = new PEAR_ErrorStack('test', false, null, true); - $z = $this->stack->push(2, 'exception', array('my' => 'param'), 'hello', - array('test'), array(array('file' => 'boof', 'line' => 34))); - $this->assertEquals('pear_error', strtolower(get_class($z)), 'not pear_error'); - $err = $this->stack->pop('exception'); - if (is_a($z, 'PEAR_Error')) { - $this->assertEquals($err, $z->getUserInfo(), 'userinfo wrong'); - } - unset($err['time']); - $this->assertEquals( - array( - 'code' => 2, - 'params' => array('my' => 'param'), - 'package' => 'test', - 'message' => 'hello', - 'level' => 'exception', - 'context' => - array( - 'file' => 'boof', - 'line' => 34, - ), - 'repackage' => array('test'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function contextcallback($code, $params, $trace) - { - $this->assertEquals(4, $code, 'wrong context code'); - $this->assertEquals(array('hello' => 6), $params, 'wrong context params'); - $this->wasCalled = true; - return array('hi' => 'there', 'you' => 'fool'); - } - - function test_valid_contextconstructor() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = new PEAR_ErrorStack('test', false, array(&$this, 'contextcallback')); - $this->wasCalled = false; - $this->stack->push(4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'context callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - 'context' => array('hi' => 'there', 'you' => 'fool'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_contextsingleton() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test', false, array(&$this, 'contextcallback')); - $this->wasCalled = false; - $this->stack->push(4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'context callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - 'context' => array('hi' => 'there', 'you' => 'fool'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_context_setcontext() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('setContextCallback')) { - return; - } - $this->stack->setContextCallback(array(&$this, 'contextcallback')); - $this->wasCalled = false; - $this->stack->push(4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'context callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - 'context' => array('hi' => 'there', 'you' => 'fool'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function messagecallback(&$stack, $err) - { - $this->assertEquals(4, $err['code'], 'wrong message code'); - $this->assertEquals(array('hello' => 6), $err['params'], 'wrong message params'); - $this->assertEquals('test1', $err['package'], 'wrong error stack'); - $this->wasCalled = true; - return 'my silly message'; - } - - function test_valid_msgcallbackconstructor() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = new PEAR_ErrorStack('test1', array(&$this, 'messagecallback')); - $this->wasCalled = false; - $this->stack->push(4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'message callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - unset($err['context']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test1', - 'message' => 'my silly message', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_msgcallbacksingleton() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test1', array(&$this, 'messagecallback')); - $this->wasCalled = false; - $this->stack->push(4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'message callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - unset($err['context']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test1', - 'message' => 'my silly message', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_msgcallback_setmsgcallback() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('setContextCallback')) { - return; - } - $this->stack = new PEAR_ErrorStack('test1'); - $this->stack->setMessageCallback(array(&$this, 'messagecallback')); - $this->wasCalled = false; - $this->stack->push(4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'message callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - unset($err['context']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test1', - 'message' => 'my silly message', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpopcallback.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpopcallback.php deleted file mode 100644 index 02b33b9057..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpopcallback.php +++ /dev/null @@ -1,320 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_pushpopcallback extends PHPUnit_TestCase -{ - /** - * A PEAR_PackageFileManager object - * @var object - */ - var $packagexml; - - function Error_Stack_TestCase_pushpopcallback($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack('test'); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function returnsignore($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_IGNORE; - } - - function test_return_ignore() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('pushCallback')) { - return; - } - if (!$this->_methodExists('popCallback')) { - return; - } - $this->stack->pushCallback(array(&$this, 'returnsignore')); - $this->wasCalled = false; - $this->stack->push(1); - $this->assertTrue($this->wasCalled, 'returnsignore not called'); - $err = $this->stack->pop(); - $this->assertFalse($err, 'error was not ignored!'); - $this->stack->popCallback(); - $this->wasCalled = false; - $this->stack->push(1); - $this->assertFalse($this->wasCalled, 'returnsignore called'); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else' - ); - - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function returnsnothing($err) - { - $this->wasCalled = true; - } - - function test_return_nothing() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('pushCallback')) { - return; - } - if (!$this->_methodExists('popCallback')) { - return; - } - $this->stack->pushCallback(array(&$this, 'returnsnothing')); - $this->wasCalled = false; - $this->stack->push(1); - $this->assertTrue($this->wasCalled, 'returnsnothing not called'); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $this->stack->popCallback(); - $this->wasCalled = false; - $this->stack->push(1); - $this->assertFalse($this->wasCalled, 'returnsnothing called'); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else' - ); - - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function returnspush($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_PUSH; - } - - function test_return_push() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('pushCallback')) { - return; - } - if (!$this->_methodExists('popCallback')) { - return; - } - if (!$this->_methodExists('setLogger')) { - return; - } - $this->stack->pushCallback(array(&$this, 'returnspush')); - $log = new BurfLog; - $log->setTestCase($this); - $log->curMethod(__FUNCTION__); - $this->stack->setLogger($log); - $this->wasCalled = false; - $this->stack->push(1); - $this->assertTrue($this->wasCalled, 'returnspush not called'); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else 1' - ); - $this->stack->popCallback(); - $log->pushExpect('', PEAR_LOG_ERR, array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - )); - $this->wasCalled = false; - $this->wasLogged = false; - $this->stack->push(1); - $this->assertFalse($this->wasCalled, 'returnspush called'); - $this->assertTrue($this->wasLogged, 'was not logged!'); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else 2' - ); - - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function returnslog($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_LOG; - } - - function test_return_log() - { - if (!$this->_methodExists('push')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('pushCallback')) { - return; - } - if (!$this->_methodExists('popCallback')) { - return; - } - if (!$this->_methodExists('setLogger')) { - return; - } - $this->stack->pushCallback(array(&$this, 'returnslog')); - $log = new BurfLog; - $log->setTestCase($this); - $log->curMethod(__FUNCTION__); - $this->stack->setLogger($log); - $this->wasCalled = false; - $this->wasLogged = false; - $log->pushExpect('', PEAR_LOG_ERR, array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - )); - $this->stack->push(1); - $this->assertTrue($this->wasCalled, 'returnslog not called'); - $this->assertTrue($this->wasLogged, 'was not logged!'); - $err = $this->stack->pop(); - $this->assertFalse($err, 'an error was pushed!'); - $this->stack->popCallback(); - $log->clearExpect(); - $log->pushExpect('', PEAR_LOG_ERR, array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - )); - $this->wasCalled = false; - $this->wasLogged = false; - $this->stack->push(1); - $this->assertFalse($this->wasCalled, 'returnspush called'); - $this->assertTrue($this->wasLogged, 'was not logged!'); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else 2' - ); - - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpopstatic.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpopstatic.php deleted file mode 100644 index e2b17bb8d8..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_pushpopstatic.php +++ /dev/null @@ -1,327 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_pushpopstatic extends PHPUnit_TestCase -{ - /** - * A PEAR_PackageFileManager object - * @var object - */ - var $packagexml; - - function Error_Stack_TestCase_pushpopstatic($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack(''); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function test_valid_basic() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test'); - PEAR_ErrorStack::staticPush('test', 1); - $err = $this->stack->pop(); - unset($err['context']); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 1, - 'params' => array(), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_params() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test'); - $z = PEAR_ErrorStack::staticPush('test', 2, 'exception', array('my' => 'param'), 'hello', - array('test'), array(array('file' => 'boof', 'line' => 34))); - $err = $this->stack->pop('exception'); - $this->assertEquals($z, $err, 'popped different error'); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 2, - 'params' => array('my' => 'param'), - 'package' => 'test', - 'message' => 'hello', - 'level' => 'exception', - 'context' => - array( - 'file' => 'boof', - 'line' => 34, - ), - 'repackage' => array('test'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_paramscompat() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test', false, null, 'PEAR_ErrorStack', true); - $z = PEAR_ErrorStack::staticPush('test', 2, 'exception', array('my' => 'param'), 'hello', - array('test'), array(array('file' => 'boof', 'line' => 34))); - $this->assertEquals('pear_error', strtolower(get_class($z)), 'not pear_error'); - $err = $this->stack->pop('exception'); - if (is_a($z, 'PEAR_Error')) { - $this->assertEquals($err, $z->getUserInfo(), 'userinfo wrong'); - } - unset($err['time']); - $this->assertEquals( - array( - 'code' => 2, - 'params' => array('my' => 'param'), - 'package' => 'test', - 'message' => 'hello', - 'level' => 'exception', - 'context' => - array( - 'file' => 'boof', - 'line' => 34, - ), - 'repackage' => array('test'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function contextcallback($code, $params, $trace) - { - $this->assertEquals(4, $code, 'wrong context code'); - $this->assertEquals(array('hello' => 6), $params, 'wrong context params'); - $this->wasCalled = true; - return array('hi' => 'there', 'you' => 'fool'); - } - - function test_valid_contextsingleton() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test', false, array(&$this, 'contextcallback')); - $this->wasCalled = false; - PEAR_ErrorStack::staticPush('test', 4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'context callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - 'context' => array('hi' => 'there', 'you' => 'fool'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_context_setcontext() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('setContextCallback')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test'); - $this->stack->setContextCallback(array(&$this, 'contextcallback')); - $this->wasCalled = false; - PEAR_ErrorStack::staticPush('test', 4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'context callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test', - 'message' => '', - 'level' => 'error', - 'context' => array('hi' => 'there', 'you' => 'fool'), - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function messagecallback(&$stack, $err) - { - $this->assertEquals(4, $err['code'], 'wrong message code'); - $this->assertEquals(array('hello' => 6), $err['params'], 'wrong message params'); - $this->assertEquals('test1', $err['package'], 'wrong error stack'); - $this->wasCalled = true; - return 'my silly message'; - } - - function test_valid_msgcallbacksingleton() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test1', array(&$this, 'messagecallback')); - $this->wasCalled = false; - PEAR_ErrorStack::staticPush('test1', 4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'message callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - unset($err['context']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test1', - 'message' => 'my silly message', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } - - function test_valid_msgcallback_setmsgcallback() - { - if (!$this->_methodExists('staticPush')) { - return; - } - if (!$this->_methodExists('singleton')) { - return; - } - if (!$this->_methodExists('pop')) { - return; - } - if (!$this->_methodExists('setContextCallback')) { - return; - } - $this->stack = &PEAR_ErrorStack::singleton('test1'); - $this->stack->setMessageCallback(array(&$this, 'messagecallback')); - $this->wasCalled = false; - PEAR_ErrorStack::staticPush('test1', 4, 'error', array('hello' => 6)); - $this->assertTrue($this->wasCalled, 'message callback was not called!'); - $err = $this->stack->pop(); - unset($err['time']); - unset($err['context']); - $this->assertEquals( - array( - 'code' => 4, - 'params' => array('hello' => 6), - 'package' => 'test1', - 'message' => 'my silly message', - 'level' => 'error', - ), - $err, 'popped something else' - ); - $err = $this->stack->pop(); - $this->assertFalse($err, 'stack not empty!'); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_singleton.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_singleton.php deleted file mode 100644 index f2d8ec0a84..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_singleton.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_singleton extends PHPUnit_TestCase -{ - /** - * A PEAR_PackageFileManager object - * @var object - */ - var $packagexml; - - function Error_Stack_TestCase_singleton($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = new PEAR_ErrorStack(''); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function test_valid_singleton() - { - if (!$this->_methodExists('singleton')) { - return; - } - $one = &PEAR_ErrorStack::singleton('first'); - $two = &PEAR_ErrorStack::singleton('first'); - $two->testme = 2; - $this->assertEquals(2, $two->testme, 'duh test'); - $one->testme = 4; - $this->assertEquals(4, $one->testme, 'duh test 2'); - $this->assertEquals(4, $two->testme, 'same object test'); - } - - function test_invalid_singleton() - { - if (!$this->_methodExists('singleton')) { - return; - } - $one = &PEAR_ErrorStack::singleton('first'); - $two = &PEAR_ErrorStack::singleton('second'); - $two->testme = 2; - $this->assertEquals(2, $two->testme, 'duh test'); - $one->testme = 4; - $this->assertEquals(4, $one->testme, 'duh test 2'); - $this->assertEquals(2, $two->testme, 'not same object test'); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_staticGetErrors.php b/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_staticGetErrors.php deleted file mode 100644 index a7a3e0b84b..0000000000 --- a/pear/tests/PEAR_ErrorStack/Error_Stack_TestCase_staticGetErrors.php +++ /dev/null @@ -1,225 +0,0 @@ -<?php - -/** - * API Unit tests for PEAR_ErrorStack package. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> portions from HTML_CSS - * @author Greg Beaver - * @package PEAR_ErrorStack - */ - -/** - * @package PEAR_ErrorStack - */ - -class Error_Stack_TestCase_staticGetErrors extends PHPUnit_TestCase -{ - - function Error_Stack_TestCase_staticGetErrors($name) - { - $this->PHPUnit_TestCase($name); - } - - function setUp() - { - error_reporting(E_ALL); - $this->errorOccured = false; - set_error_handler(array(&$this, 'errorHandler')); - $this->stack = &PEAR_ErrorStack::singleton('test'); - $s = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); - $s->pushCallback(array('PEAR_ErrorStack', '_handleError')); - } - - function tearDown() - { - unset($this->stack); - unset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON']); - } - - - function _stripWhitespace($str) - { - return preg_replace('/\\s+/', '', $str); - } - - function _methodExists($name) - { - if (in_array(strtolower($name), get_class_methods($this->stack))) { - return true; - } - $this->assertTrue(false, 'method '. $name . ' not implemented in ' . get_class($this->stack)); - return false; - } - - function errorHandler($errno, $errstr, $errfile, $errline) { - //die("$errstr in $errfile at line $errline: $errstr"); - $this->errorOccured = true; - $this->assertTrue(false, "$errstr at line $errline, $errfile"); - } - - function returnsignore($err) - { - $this->wasCalled = true; - return PEAR_ERRORSTACK_IGNORE; - } - - function test_none() - { - if (!$this->_methodExists('staticGetErrors')) { - return; - } - $this->assertEquals(array(), PEAR_ErrorStack::staticGetErrors()); - $this->assertEquals(array(), PEAR_ErrorStack::staticGetErrors(true)); - } - - function test_normal() - { - if (!$this->_methodExists('staticGetErrors')) { - return; - } - $this->assertEquals(array(), PEAR_ErrorStack::staticGetErrors()); - $this->stack->push(1); - $this->stack->push(2, 'warning'); - $this->stack->push(3, 'foo'); - $ret = PEAR_ErrorStack::staticGetErrors(); - for ($i= 0; $i < 3; $i++) { - unset($ret['test'][$i]['time']); - unset($ret['test'][$i]['context']); - } - $this->assertEquals( - array( 'test' => array( - array('code' => 3, - 'params' => array(), - 'package' => 'test', - 'level' => 'foo', - 'message' => ''), - array('code' => 2, - 'params' => array(), - 'package' => 'test', - 'level' => 'warning', - 'message' => ''), - array('code' => 1, - 'params' => array(), - 'package' => 'test', - 'level' => 'error', - 'message' => ''), - )), $ret, 'incorrect errors, non-purge'); - $ret = PEAR_ErrorStack::staticGetErrors(true); - for ($i= 0; $i < 3; $i++) { - unset($ret['test'][$i]['time']); - unset($ret['test'][$i]['context']); - } - $this->assertEquals( - array( 'test' => array( - array('code' => 3, - 'params' => array(), - 'package' => 'test', - 'level' => 'foo', - 'message' => ''), - array('code' => 2, - 'params' => array(), - 'package' => 'test', - 'level' => 'warning', - 'message' => ''), - array('code' => 1, - 'params' => array(), - 'package' => 'test', - 'level' => 'error', - 'message' => ''), - )), $ret, 'incorrect errors, purge'); - $this->assertEquals(array(), PEAR_ErrorStack::staticGetErrors()); - } - - function test_merge() - { - if (!$this->_methodExists('staticGetErrors')) { - return; - } - $this->assertEquals(array(), PEAR_ErrorStack::staticGetErrors()); - $this->stack->push(1); - for($i=0;$i<10000;$i++); - $this->stack->push(2, 'warning'); - for($i=0;$i<10000;$i++); - PEAR_ErrorStack::staticPush('fronk', 3, 'foo'); - $ret = PEAR_ErrorStack::staticGetErrors(true, false, true); - for ($i= 0; $i < 3; $i++) { - unset($ret[$i]['time']); - unset($ret[$i]['context']); - } - $this->assertEquals( - array( - array('code' => 3, - 'params' => array(), - 'package' => 'fronk', - 'level' => 'foo', - 'message' => ''), - array('code' => 2, - 'params' => array(), - 'package' => 'test', - 'level' => 'warning', - 'message' => ''), - array('code' => 1, - 'params' => array(), - 'package' => 'test', - 'level' => 'error', - 'message' => ''), - ), $ret, 'incorrect errors, non-purge'); - $test = PEAR_ErrorStack::staticGetErrors(); - $this->assertEquals(array(), $test, 'normal array'); - } - - function _sortErrorsRev($a, $b) - { - $this->wasCalled = true; - if ($a['time'] == $b['time']) { - return 0; - } - if ($a['time'] < $b['time']) { - return -1; - } - return 1; - } - - function test_merge_sortfunc() - { - if (!$this->_methodExists('staticGetErrors')) { - return; - } - $this->assertEquals(array(), PEAR_ErrorStack::staticGetErrors()); - $this->stack->push(1); - for($i=0;$i<10000;$i++); - $this->stack->push(2, 'warning'); - for($i=0;$i<10000;$i++); - PEAR_ErrorStack::staticPush('fronk', 3, 'foo'); - $this->wasCalled = false; - $ret = PEAR_ErrorStack::staticGetErrors(true, false, true, array(&$this, '_sortErrorsRev')); - $this->assertTrue($this->wasCalled, '_sortErrorsRev not called!'); - for ($i= 0; $i < 3; $i++) { - unset($ret[$i]['time']); - unset($ret[$i]['context']); - } - $this->assertEquals( - array( - array('code' => 1, - 'params' => array(), - 'package' => 'test', - 'level' => 'error', - 'message' => ''), - array('code' => 2, - 'params' => array(), - 'package' => 'test', - 'level' => 'warning', - 'message' => ''), - array('code' => 3, - 'params' => array(), - 'package' => 'fronk', - 'level' => 'foo', - 'message' => ''), - ), $ret, 'incorrect errors, non-purge'); - $test = PEAR_ErrorStack::staticGetErrors(); - $this->assertEquals(array(), $test, 'normal array'); - } -} - -?> diff --git a/pear/tests/PEAR_ErrorStack/HTML_TestListener.php b/pear/tests/PEAR_ErrorStack/HTML_TestListener.php deleted file mode 100644 index a6b3ca6588..0000000000 --- a/pear/tests/PEAR_ErrorStack/HTML_TestListener.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/** - * Provides a nice HTML output for PHPUnit suite tests. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> - * @package HTML_CSS - */ - -class HTML_TestListener extends PHPUnit_TestListener { - - function HTML_TestListener() { - -$report = <<<EOS -<table cellspacing="1" cellpadding="1" border="0" width="90%" align="center" class="details"> -<tr><th>Class</th><th>Function</th><th>Success</th><th>Meta-result</th></tr> -EOS; - echo $report; - } - - function addError(&$test, &$t) { - $this->_errors += 1; - } - - function addFailure(&$test, &$t) { - $this->_fails += 1; - } - - function endTest(&$test) { - /* Report both the test result and, for this special situation - where some tests are expected to fail, a "meta" test result - which indicates whether the test result matches the - expected result. - */ - $expect_failure = preg_match('/fail/i', $test->getName()); - $test_passed = ($this->_fails == 0 && $this->_errors == 0); - - if ($this->_errors > 0) { - $outcome = "<span class=\"Error\">ERROR</span>"; - } else if ($this->_fails > 0) { - $outcome = "<span class=\"Failure\">FAIL</span>"; - } else { - $outcome = "<span class=\"Pass\">OK</span>"; - } - if ($this->_errors > 0) { - $meta_outcome = '<span class="Unknown">unknown</span>'; - } else { - $meta_outcome = ($expect_failure xor $test_passed) - ? '<span class="Expected">as expected</span>' - : '<span class="Unexpected">UNEXPECTED</span>'; - } - printf("<td>$outcome</td><td>$meta_outcome</td></tr>"); - } - - function startTest(&$test) { - $this->_fails = 0; - $this->_errors = 0; - printf("<tr><td>%s </td><td>%s </td>", get_class($test), $test->getName()); - } - - -} -?>
\ No newline at end of file diff --git a/pear/tests/PEAR_ErrorStack/TestUnit.php b/pear/tests/PEAR_ErrorStack/TestUnit.php deleted file mode 100644 index 1fe703f664..0000000000 --- a/pear/tests/PEAR_ErrorStack/TestUnit.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/** - * TestUnit runs a TestSuite and returns a TestResult object. - * And more than PHPUnit attach a listener to TestResult. - * - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> - * @package HTML_CSS - */ - -require_once 'PHPUnit.php'; - -class TestUnit extends PHPUnit { - - function &run(&$suite, $listener) { - $result = new TestResult(); - $result->addListener($listener); - $suite->run($result); - - return $result; - } -} - -class TestResult extends PHPUnit_TestResult { - - /* report result of test run */ - function report() { - echo "</TABLE>"; - - $nRun = $this->runCount(); - $nErrors = $this->errorCount(); - $nFailures = $this->failureCount(); - echo "<h2>Summary</h2>"; - - printf("<p>%s test%s run.<br>", $nRun, ($nRun > 1) ? 's' : ''); - printf("%s error%s.<br>\n", $nErrors, ($nErrors > 1) ? 's' : ''); - printf("%s failure%s.<br>\n", $nFailures, ($nFailures > 1) ? 's' : ''); - if ($nFailures > 0) { - echo "<h2>Failure Details</h2>"; - print("<ol>\n"); - $failures = $this->failures(); - while (list($i, $failure) = each($failures)) { - $failedTest = $failure->failedTest(); - printf("<li>%s\n", $failedTest->getName() ); - print("<ul>"); - printf("<li>%s\n", $failure->thrownException() ); - print("</ul>"); - } - print("</ol>\n"); - } - } - -} -?> diff --git a/pear/tests/PEAR_ErrorStack/base_regression.php b/pear/tests/PEAR_ErrorStack/base_regression.php deleted file mode 100644 index 16e9eeb302..0000000000 --- a/pear/tests/PEAR_ErrorStack/base_regression.php +++ /dev/null @@ -1,550 +0,0 @@ -<?php -// $Revision$ -/** - * Basic regression test for PEAR_ErrorStack::getFileLine() - * - * phpUnit can't test global code properly because of its design, so I designed - * this instead - * @package PEAR_ErrorStack - * @subpackage tests - * @author Greg Beaver <cellog@php.net> - */ -require_once 'PEAR/ErrorStack.php'; -$result = array( -'passed' => array(), -'failed' => array() -); -$stack = &PEAR_ErrorStack::singleton('test'); -$testNumber = 1; -// test basic global file/line -$stack->push(3); -$testline = __LINE__ - 1; - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'function' => 'include_once', - 'line' => $testline)); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test basic in-function file/line #2 -function testfunc() { global $stack, $testline; -$stack->push(3); -$testline = __LINE__ - 1; -} -testfunc(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'testfunc')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test basic in-static method file/line #3 -class stclass { -function stfunc() { global $stack, $testline; -$stack->push(3); -$testline = __LINE__ - 1; -} -} -stclass::stfunc(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'stfunc', - 'class' => 'stclass')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test basic in-method file/line #4 -class normalclass { -function normalfunc() { global $stack, $testline; -$stack->push(3); -$testline = __LINE__ - 1; -} -} -$z = new normalclass; -$z->normalfunc(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'normalfunc', - 'class' => 'normalclass')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test global eval file/line #5 -eval('$stack->push(3);'); -$testline = __LINE__ - 1; - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'function' => 'include_once', - 'line' => $testline)); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test in-function eval file/line #6 -function test2() { - global $testline, $stack; -eval('$stack->push(3);'); -$testline = __LINE__ - 1; -} -test2(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'test2')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test in-static method eval file/line #7 -class test3 { -function test3() { - global $testline, $stack; -eval('$stack->push(3);'); -$testline = __LINE__ - 1; -} -} -test3::test3(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'test3', - 'class' => 'test3')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test in-method eval file/line #8 -class test4 { -function test4() { - global $testline, $stack; -eval('$stack->push(3);'); -$testline = __LINE__ - 1; -} -} -$z = new test4; -$z->test4(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'test4', - 'class' => 'test4')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test global create_function file/line #9 -$a = create_function('', '$GLOBALS["stack"]->push(3);'); -$testline = __LINE__ - 1; -$a(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test in-function create_function file/line #10 -function test7() { global $a; -$a(); -} -test7(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test in-static method create_function file/line #11 -class test8 { -function test8() { global $a; -$a(); -} -} -test8::test8(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test in-method create_function file/line #12 -class test9 { -function test9() { global $a; -$a(); -} -} -$z = new test9; -$z->test9(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$result['number'] = $testNumber; - -$testNumber++; -// test static basic global file/line #13 -PEAR_ErrorStack::staticPush('test', 3); -$testline = __LINE__ - 1; - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'function' => 'include_once', - 'line' => $testline)); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static basic in-function file/line #14 -function testfunc2() { global $stack, $testline; -PEAR_ErrorStack::staticPush('test', 3); -$testline = __LINE__ - 1; -} -testfunc2(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'testfunc2')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static basic in-static method file/line #15 -class stclass2 { -function stfunc() { global $stack, $testline; -PEAR_ErrorStack::staticPush('test', 3); -$testline = __LINE__ - 1; -} -} -stclass2::stfunc(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'stfunc', - 'class' => 'stclass2')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static basic in-method file/line #16 -class normalclass2 { -function normalfunc() { global $stack, $testline; -PEAR_ErrorStack::staticPush('test', 3); -$testline = __LINE__ - 1; -} -} -$z = new normalclass2; -$z->normalfunc(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'normalfunc', - 'class' => 'normalclass2')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static global eval file/line #17 -eval('PEAR_ErrorStack::staticPush(\'test\', 3);'); -$testline = __LINE__ - 1; - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'function' => 'include_once', - 'line' => $testline)); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static in-function eval file/line #18 -function test22() { - global $testline, $stack; -eval('PEAR_ErrorStack::staticPush("test", 3);'); -$testline = __LINE__ - 1; -} -test22(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'test22')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static in-static method eval file/line #19 -class test32 { -function test3() { - global $testline, $stack; -eval('PEAR_ErrorStack::staticPush(\'test\',3);'); -$testline = __LINE__ - 1; -} -} -test32::test3(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'test3', - 'class' => 'test32')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static in-method eval file/line #20 -class test42 { -function test4() { - global $testline, $stack; -eval('PEAR_ErrorStack::staticPush(\'test\',3);'); -$testline = __LINE__ - 1; -} -} -$z = new test42; -$z->test4(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'test4', - 'class' => 'test42')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static global create_function file/line #21 -$a = create_function('', 'PEAR_ErrorStack::staticPush("test",3);'); -$testline = __LINE__ - 1; -$a(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static in-function create_function file/line #22 -function test72() { global $a; -$a(); -} -test72(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static in-static method create_function file/line #23 -class test82 { -function test8() { global $a; -$a(); -} -} -test82::test8(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$testNumber++; -// test static in-method create_function file/line #24 -class test92 { -function test9() { global $a; -$a(); -} -} -$z = new test92; -$z->test9(); - -$ret = $stack->pop(); -$diff = array_diff_assoc($ret['context'], -array('file' => __FILE__, - 'line' => $testline, - 'function' => 'create_function() code')); - -if ($diff !== array()) { - $result['failed'][$testNumber] = $diff; -} else { - $result['passed'][$testNumber] = true; -} - -$result['number'] = $testNumber; - -return $result; -/** - * Utility function - */ -function isIncludeable($path) -{ - if (file_exists(realpath($path)) && is_readable(realpath($path))) { - return true; - } - foreach (explode(PATH_SEPARATOR, get_include_path()) as $prepend) { - $test = realpath($prepend . DIRECTORY_SEPARATOR . $path); - if (file_exists($test) && is_readable($test)) { - return true; - } - } -} -/** - * Mock PHPUnit object - */ -class Mock_PHPUnit { - var $name; - function getName() - { - return 'base regression test ' . $this->name; - } -} -?>
\ No newline at end of file diff --git a/pear/tests/PEAR_ErrorStack/stylesheet.css b/pear/tests/PEAR_ErrorStack/stylesheet.css deleted file mode 100644 index 47b9f92b2a..0000000000 --- a/pear/tests/PEAR_ErrorStack/stylesheet.css +++ /dev/null @@ -1,65 +0,0 @@ -/* $Id$ */ - -body { - font:normal 68% verdana,arial,helvetica; - color:#000000; -} -table tr td, table tr th { - font-size: 68%; -} -table.details tr th{ - font-weight: bold; - text-align:left; - background:#a6caf0; -} -table.details tr{ - background:#eeeee0; -} - -p { - line-height:1.5em; - margin-top:0.5em; margin-bottom:1.0em; -} -h1 { - margin: 0px 0px 5px; font: 165% verdana,arial,helvetica -} -h2 { - margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica -} -h3 { - margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica -} -h4 { - margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica -} -h5 { - margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica -} -h6 { - margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica -} -.Error { - font-weight:bold; color:red; -} -.Failure, .Unexpected { - background:#ff0000; font-weight:bold; color:black; -} -.Unknown { - background:#ffff00; font-weight:bold; color:black; -} -.Pass, .Expected { - background:#00ff00; font-weight:bold; color:black; -} -.Properties { - text-align:right; -} - -CODE.expected { - color: green; background: none; font-weight: normal; -} -CODE.actual { - color: red; background: none; font-weight: normal; -} -.typeinfo { - color: gray; -} diff --git a/pear/tests/PEAR_ErrorStack/testsuite.php b/pear/tests/PEAR_ErrorStack/testsuite.php deleted file mode 100644 index 0dcb149ff1..0000000000 --- a/pear/tests/PEAR_ErrorStack/testsuite.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php - -/** - * HTML output for PHPUnit suite tests. - * - * Copied for PEAR_PackageFileManager from HTML_CSS - * @version $Id$ - * @author Laurent Laville <pear@laurent-laville.org> - * @package HTML_CSS - */ - -require_once 'TestUnit.php'; -require_once 'HTML_TestListener.php'; -require_once 'PEAR/ErrorStack.php'; - -$title = 'PhpUnit test run, PEAR_ErrorStack package'; -?> -<html> -<head> -<title><?php echo $title; ?></title> -<link rel="stylesheet" href="stylesheet.css" type="text/css" /> -</head> -<body> -<h1><?php echo $title; ?></h1> - <p> - This page runs all the phpUnit self-tests, and produces nice HTML output. - </p> - <p> - Unlike typical test run, <strong>expect many test cases to - fail</strong>. Exactly those with <code>pass</code> in their name - should succeed. - </p> - <p> - For each test we display both the test result -- <span - class="Pass">ok</span>, <span class="Failure">FAIL</span>, or - <span class="Error">ERROR</span> -- and also a meta-result -- - <span class="Expected">as expected</span>, <span - class="Unexpected">UNEXPECTED</span>, or <span - class="Unknown">unknown</span> -- that indicates whether the - expected test result occurred. Although many test results will - be 'FAIL' here, all meta-results should be 'as expected', except - for a few 'unknown' meta-results (because of errors) when running - in PHP3. - </p> - -<h2>Tests</h2> - <?php - $testcases = array( - 'Error_Stack_TestCase_singleton', - 'Error_Stack_TestCase_pushpop', - 'Error_Stack_TestCase_pushpopstatic', - 'Error_Stack_TestCase_pushpopcallback', - 'Error_Stack_TestCase_getErrorMessage', - 'Error_Stack_TestCase_getErrorMessageTemplate', - 'Error_Stack_TestCase_getErrors', - 'Error_Stack_TestCase_staticGetErrors', - ); -define('PEAR_LOG_EMERG', 0); /** System is unusable */ -define('PEAR_LOG_ALERT', 1); /** Immediate action required */ -define('PEAR_LOG_CRIT', 2); /** Critical conditions */ -define('PEAR_LOG_ERR', 3); /** Error conditions */ -define('PEAR_LOG_WARNING', 4); /** Warning conditions */ -define('PEAR_LOG_NOTICE', 5); /** Normal but significant */ -define('PEAR_LOG_INFO', 6); /** Informational */ -define('PEAR_LOG_DEBUG', 7); /** Debug-level messages */ -/** -* Mock Log object -*/ -class BurfLog { - var $testcase; - var $method; - var $expect = array(); - function setTestCase(&$testcase) - { - $this->testcase = &$testcase; - } - - function curMethod($method) - { - $this->method = $method; - } - - function pushExpect($message, $priority, $errarray) - { - unset($errarray['time']); - unset($errarray['context']); - array_push($this->expect, array($message, $priority, $errarray)); - } - - function clearExpect() - { - $this->expect = array(); - } - - function log($message, $priority, $errarray) - { - $this->testcase->wasLogged = true; - if (!is_a($this->testcase, 'PHPUnit_TestCase')) { - trigger_error('ERROR: burflog never set up', E_USER_ERROR); - return; - } - if (!isset($this->method)) { - $this->testcase->assertFalse(true, 'ERROR: burflog never set up'); - return; - } - if (!count($this->expect)) { - $this->testcase->assertFalse(true, "method $this->method: logged, but no log expected"); - $this->testcase->assertFalse(true, "method $this->method: log message = $message"); - $this->testcase->assertFalse(true, "method $this->method: log priority = $priority"); - return; - } - unset($errarray['time']); - unset($errarray['context']); - $expect = array_pop($this->expect); - $this->testcase->assertEquals($expect[0], $message, "method $this->method: wrong message"); - $this->testcase->assertEquals($expect[1], $priority, "method $this->method: wrong priority"); - $this->testcase->assertEquals($expect[2], $errarray, "method $this->method: wrong errarray"); - } -} - - $suite = new PHPUnit_TestSuite(); - - foreach ($testcases as $testcase) { - include_once $testcase . '.php'; - $suite->addTestSuite($testcase); - } - - $listener = new HTML_TestListener(); - $finalresult = TestUnit::run($suite, $listener); - $results = include_once dirname(__FILE__) . '/base_regression.php'; - $num = $results['number']; - $failed = $results['failed']; - $passed = $results['passed']; - for ($i = 1; $i <= $num; $i++) { - $bla = new Mock_PHPUnit; - $bla->name = $i; - $listener->startTest($bla); - if (isset($failed[$i])) { - $listener->addFailure($bla, $failed[$i]); - $finalresult->addFailure($bla, $a = 'context had additional ' . serialize($failed[$i])); - } - $listener->endTest($bla); - } - - $finalresult->removeListener($listener); - // hack in the base regression test count - $finalresult->_runTests += count($results['failed']) + count($results['passed']); - $finalresult->report(); - - ?> -</body> -</html> diff --git a/pear/tests/PEAR_test_mock_pearweb.php.inc b/pear/tests/PEAR_test_mock_pearweb.php.inc deleted file mode 100644 index 11cb0cc25c..0000000000 --- a/pear/tests/PEAR_test_mock_pearweb.php.inc +++ /dev/null @@ -1,233 +0,0 @@ -<?php - -class PEAR_test_mock_pearweb { - var $_config; - var $_remote; - - function setRemote(&$r) - { - $this->_remote = &$r; - } - - function addHtmlConfig($address, $filename) - { - $this->_config['html'][$address] = array(basename($filename), file_get_contents($filename)); - } - - function addXmlrpcConfig($method, $params, $return) - { - $this->_config['xmlrpc'][$method][serialize($params)] = $return; - } - - function _encode($val) - { - $val = XML_RPC_encode($val); - $ser = new XML_RPC_Response($val); - return $ser->serialize(); - } - - function receiveHttp($address) - { - if (!isset($this->_config) || !is_array($this->_config)) { - return $this->do404($address); - } - if (!isset($this->_config['html'][$address])) { - return $this->do404($address); - } else { - return $this->do200() . - 'content-length: ' . strlen($this->_config['html'][$address][1]) . "\n\n" . - $this->_config['html'][$address][1]; - } - } - - function receiveXmlrpc($postpayload) - { - $info = $this->parseRequest($postpayload); - if (!isset($this->_config['xmlrpc'][$info['method']])) { - return $this->doXmlrpcFault($info); - } - if (!isset($this->_config['xmlrpc'][serialize($info['params'])])) { - var_dump($info['param']); - die("Error - parameters not configured properly for $info[method]"); - } - return $this->do200() . - $this->_encode($this->_config['xmlrpc'][$info['method']][serialize($info['params'])]); - } - - function call($method, $params) - { - if (!isset($this->_config['xmlrpc'][$method])) { - include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'php_dump.php.inc'; - $args = $params; - switch (count($args)) { - case 0: - $result = $this->_remote->parentcall($method); - break; - case 1: - $result = $this->_remote->parentcall($method, $args[0]); - break; - case 2: - $result = $this->_remote->parentcall($method, $args[0], $args[1]); - break; - case 3: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2]); - break; - case 4: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2], $args[3]); - break; - case 5: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2], $args[3], $args[4]); - break; - case 6: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); - break; - } - $dump = new PHP_Dump($result); - $args = new PHP_Dump($args); - if (!isset($this->_pearweb->_config['xmlrpc'][$method][serialize($args)])) - $GLOBALS['totalPHP'][$method . serialize($args)] = '$pearweb->addXmlrpcConfig("' . - $method . '", ' . - $args->toPHP() . ', ' . - $dump->toPHP() .");"; - foreach($GLOBALS['totalPHP'] as $php) { - echo $php . "\n"; - } - var_dump(array_keys($this->_config['xmlrpc'][$method]), $params); - die("Error - parameters not configured properly for $method"); - return false; - } - if (!isset($this->_config['xmlrpc'][$method][serialize($params)])) { - include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'php_dump.php.inc'; - $args = $params; - switch (count($args)) { - case 0: - $result = $this->_remote->parentcall($method); - break; - case 1: - $result = $this->_remote->parentcall($method, $args[0]); - break; - case 2: - $result = $this->_remote->parentcall($method, $args[0], $args[1]); - break; - case 3: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2]); - break; - case 4: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2], $args[3]); - break; - case 5: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2], $args[3], $args[4]); - break; - case 6: - $result = $this->_remote->parentcall($method, $args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); - break; - } - $dump = new PHP_Dump($result); - $args = new PHP_Dump($args); - if (!isset($this->_pearweb->_config['xmlrpc'][$method][serialize($args)])) - $GLOBALS['totalPHP'][$method . serialize($args)] = '$pearweb->addXmlrpcConfig("' . - $method . '", ' . - $args->toPHP() . ', ' . - $dump->toPHP() .");"; - foreach($GLOBALS['totalPHP'] as $php) { - echo $php . "\n"; - } - var_dump(array_keys($this->_config['xmlrpc'][$method]), $params); - die("Error - parameters not configured properly for $method"); - } - return $this->_config['xmlrpc'][$method][serialize($params)]; - } - - function doXmlrpcFault($info) - { - $r = new XML_RPC_Response(0, 1, 'Unknown method'); - return $this->do200() . $r->serialize(); - } - - function do200() - { - return "HTTP/1.1 200 \n"; - } - - function do404($address) - { - return 'HTTP/1.1 404 ' . $address . ' Is not valid'; - } - - /** - * Parse an xmlrpc request - * @param string fake HTTP_RAW_POST_DATA - * @return string|array serialized fault string, or array containing method name and parameters - */ - function parseRequest($data) - { - // copied from XML_RPC_Server - global $XML_RPC_xh; - global $XML_RPC_err, $XML_RPC_str, $XML_RPC_errxml, - $XML_RPC_defencoding, $XML_RPC_Server_dmap; - - $parser = xml_parser_create($XML_RPC_defencoding); - - $XML_RPC_xh[$parser] = array(); - $XML_RPC_xh[$parser]['st'] = ""; - $XML_RPC_xh[$parser]['cm'] = 0; - $XML_RPC_xh[$parser]['isf'] = 0; - $XML_RPC_xh[$parser]['params'] = array(); - $XML_RPC_xh[$parser]['method'] = ""; - - $plist = ''; - - // decompose incoming XML into request structure - - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); - xml_set_element_handler($parser, "XML_RPC_se", "XML_RPC_ee"); - xml_set_character_data_handler($parser, "XML_RPC_cd"); - xml_set_default_handler($parser, "XML_RPC_dh"); - if (!xml_parse($parser, $data, 1)) { - // return XML error as a faultCode - $r = new XML_RPC_Response(0, - $XML_RPC_errxml+xml_get_error_code($parser), - sprintf("XML error: %s at line %d", - xml_error_string(xml_get_error_code($parser)), - xml_get_current_line_number($parser))); - xml_parser_free($parser); - return $r->serialize(); - } else { - xml_parser_free($parser); - $params = array(); - // now add parameters in - for ($i = 0; $i < sizeof($XML_RPC_xh[$parser]['params']); $i++) { - // print "<!-- " . $XML_RPC_xh[$parser]['params'][$i]. "-->\n"; - $plist .= "$i - " . $XML_RPC_xh[$parser]['params'][$i] . " \n"; - eval('$val = ' . $XML_RPC_xh[$parser]['params'][$i] . ";"); - $param = $val->scalarval(); - $param = PEAR_test_mock_pearweb::_convertScalar($param); - $params[] = $param; - } - return array('method' => $XML_RPC_xh[$parser]['method'], 'params' => $params); - } - } - - /** - * Converts the mishmash returned from XML_RPC parsing into a regular PHP value, - * handling nested arrays gracefully. - * @param mixed - * @return mixed - */ - function _convertScalar($val) - { - if (is_a($val, 'XML_RPC_Value')) { - $val = $val->scalarval(); - } - if (!is_array($val)) { - return $val; - } - $newval = array(); - foreach ($val as $i => $contents) - { - $newval[$i] = PEAR_test_mock_pearweb::_convertScalar($contents); - } - return $newval; - } -} -?> diff --git a/pear/tests/common_sortPkgDeps1_package.xml b/pear/tests/common_sortPkgDeps1_package.xml deleted file mode 100644 index a103b10c66..0000000000 --- a/pear/tests/common_sortPkgDeps1_package.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg1</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1</version> - <date>2003-09-09</date> - <state>stable</state> - <notes> - required dependency test - </notes> - <deps> - <dep type="pkg" version="1.0" rel="ge">pkg2</dep> - </deps> - <filelist> - <dir name="/" baseinstalldir="grob" role="php"> - <file>zoorb.php</file> - <dir name="goompness" role="php"> - <file>oggbrzitzkee.php</file> - <file>Mopreeb.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/common_sortPkgDeps2_package.xml b/pear/tests/common_sortPkgDeps2_package.xml deleted file mode 100644 index 3e7c03852d..0000000000 --- a/pear/tests/common_sortPkgDeps2_package.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg2</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1</version> - <date>2003-09-09</date> - <state>stable</state> - <notes> - required dependency test - </notes> - <deps> - <dep type="pkg" version="1.0" rel="ge">pkg3</dep> - <dep type="php" version="1.0" rel="ge" /> - </deps> - <filelist> - <dir name="/" baseinstalldir="grob" role="php"> - <file>zoorb.php</file> - <dir name="goompness" role="php"> - <file>oggbrzitzkee.php</file> - <file>Mopreeb.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/common_sortPkgDeps3_package.xml b/pear/tests/common_sortPkgDeps3_package.xml deleted file mode 100644 index 830a94c70a..0000000000 --- a/pear/tests/common_sortPkgDeps3_package.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg3</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1</version> - <date>2003-09-09</date> - <state>stable</state> - <notes> - required dependency test - </notes> - <deps> - <dep type="pkg" version="1.0" rel="ge">pkg4</dep> - <dep type="pkg" version="1.0" rel="ge">pkg5</dep> - </deps> - <filelist> - <dir name="/" baseinstalldir="grob" role="php"> - <file>zoorb.php</file> - <dir name="goompness" role="php"> - <file>oggbrzitzkee.php</file> - <file>Mopreeb.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/common_sortPkgDeps4_package.xml b/pear/tests/common_sortPkgDeps4_package.xml deleted file mode 100644 index ff3394ee56..0000000000 --- a/pear/tests/common_sortPkgDeps4_package.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg4</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1</version> - <date>2003-09-09</date> - <state>stable</state> - <notes> - required dependency test - </notes> - <deps> - <dep type="pkg" version="1.0" rel="ge">pkg6</dep> - </deps> - <filelist> - <dir name="/" baseinstalldir="grob" role="php"> - <file>zoorb.php</file> - <dir name="goompness" role="php"> - <file>oggbrzitzkee.php</file> - <file>Mopreeb.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/common_sortPkgDeps5_package.xml b/pear/tests/common_sortPkgDeps5_package.xml deleted file mode 100644 index 6dea22f403..0000000000 --- a/pear/tests/common_sortPkgDeps5_package.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg5</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1</version> - <date>2003-09-09</date> - <state>stable</state> - <notes> - required dependency test - </notes> - <deps> - <dep type="pkg" version="1.0" rel="ge">pkg6</dep> - </deps> - <filelist> - <dir name="/" baseinstalldir="grob" role="php"> - <file>zoorb.php</file> - <dir name="goompness" role="php"> - <file>oggbrzitzkee.php</file> - <file>Mopreeb.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/common_sortPkgDeps6_package.xml b/pear/tests/common_sortPkgDeps6_package.xml deleted file mode 100644 index a196e7003b..0000000000 --- a/pear/tests/common_sortPkgDeps6_package.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg6</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1</version> - <date>2003-09-09</date> - <state>stable</state> - <notes> - required dependency test - </notes> - <filelist> - <dir name="/" baseinstalldir="grob" role="php"> - <file>zoorb.php</file> - <dir name="goompness" role="php"> - <file>oggbrzitzkee.php</file> - <file>Mopreeb.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/depnoreleases-1.0.tgz b/pear/tests/depnoreleases-1.0.tgz Binary files differdeleted file mode 100644 index bc1c471320..0000000000 --- a/pear/tests/depnoreleases-1.0.tgz +++ /dev/null diff --git a/pear/tests/depunstable-1.0.tgz b/pear/tests/depunstable-1.0.tgz Binary files differdeleted file mode 100644 index a5e8d262c3..0000000000 --- a/pear/tests/depunstable-1.0.tgz +++ /dev/null diff --git a/pear/tests/dirtree/multiplepackages/pkg1file.php b/pear/tests/dirtree/multiplepackages/pkg1file.php deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/dirtree/multiplepackages/pkg1file.php +++ /dev/null diff --git a/pear/tests/dirtree/multiplepackages/pkg2file.php b/pear/tests/dirtree/multiplepackages/pkg2file.php deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/dirtree/multiplepackages/pkg2file.php +++ /dev/null diff --git a/pear/tests/dirtree/nestedroot/emptydir/fakefile1.php b/pear/tests/dirtree/nestedroot/emptydir/fakefile1.php deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/dirtree/nestedroot/emptydir/fakefile1.php +++ /dev/null diff --git a/pear/tests/dirtree/nestedroot/emptydir/nesteddir/nestedfile.php b/pear/tests/dirtree/nestedroot/emptydir/nesteddir/nestedfile.php deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/dirtree/nestedroot/emptydir/nesteddir/nestedfile.php +++ /dev/null diff --git a/pear/tests/dirtree/nestedroot/rootfile.php b/pear/tests/dirtree/nestedroot/rootfile.php deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/dirtree/nestedroot/rootfile.php +++ /dev/null diff --git a/pear/tests/dirtree/package-fail.xml b/pear/tests/dirtree/package-fail.xml deleted file mode 100644 index f2bf6f15d9..0000000000 --- a/pear/tests/dirtree/package-fail.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg2</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.0</version> - <date>2003-12-11</date> - <state>stable</state> - <notes> - second package - </notes> - <filelist> - <dir name="/" baseinstalldir="test" role="php"> - <dir name="multiplepackages" role="php"> - <file>pkg2file.php</file> - </dir> - <dir name="nestedroot" role="php"> - <file>rootfile.php</file> - <dir name="emptydir" role="php"> - <dir name="nesteddir" role="php"> - <file>nestedfile.php</file> - <file>doesntexist.php</file> - </dir> - </dir> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/dirtree/package.xml b/pear/tests/dirtree/package.xml deleted file mode 100644 index 8ba556e5d0..0000000000 --- a/pear/tests/dirtree/package.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg1</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.0</version> - <date>2003-12-11</date> - <state>stable</state> - <notes> - first package - </notes> - <filelist> - <dir name="/" baseinstalldir="test" role="php"> - <dir name="multiplepackages" role="php"> - <file>pkg1file.php</file> - </dir> - <dir name="pkg1" role="php"> - <file>randomfile.php</file> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/dirtree/package2.xml b/pear/tests/dirtree/package2.xml deleted file mode 100644 index c0bde59e4a..0000000000 --- a/pear/tests/dirtree/package2.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> - <package version="1.0"> - <name>pkg2</name> - <summary>required test for PEAR_Installer</summary> - <description> - fake package - </description> - <license>PHP License</license> - <maintainers> - <maintainer> - <user>fakeuser</user> - <name>Joe Shmoe</name> - <email>nobody@example.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.0</version> - <date>2003-12-11</date> - <state>stable</state> - <notes> - second package - </notes> - <filelist> - <dir name="/" baseinstalldir="test" role="php"> - <dir name="multiplepackages" role="php"> - <file>pkg2file.php</file> - </dir> - <dir name="nestedroot" role="php"> - <file>rootfile.php</file> - <dir name="emptydir" role="php"> - <dir name="nesteddir" role="php"> - <file>nestedfile.php</file> - </dir> - </dir> - </dir> - </dir> - </filelist> - </release> - </package> diff --git a/pear/tests/dirtree/pkg1-1.0.tgz b/pear/tests/dirtree/pkg1-1.0.tgz Binary files differdeleted file mode 100644 index ab305f74a8..0000000000 --- a/pear/tests/dirtree/pkg1-1.0.tgz +++ /dev/null diff --git a/pear/tests/dirtree/pkg1/randomfile.php b/pear/tests/dirtree/pkg1/randomfile.php deleted file mode 100644 index e69de29bb2..0000000000 --- a/pear/tests/dirtree/pkg1/randomfile.php +++ /dev/null diff --git a/pear/tests/dirtree/pkg2-1.0.tgz b/pear/tests/dirtree/pkg2-1.0.tgz Binary files differdeleted file mode 100644 index 18bc9d2f48..0000000000 --- a/pear/tests/dirtree/pkg2-1.0.tgz +++ /dev/null diff --git a/pear/tests/download_test.config.inc b/pear/tests/download_test.config.inc deleted file mode 100644 index 71dd32133d..0000000000 --- a/pear/tests/download_test.config.inc +++ /dev/null @@ -1,2159 +0,0 @@ -<?php -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:4:\"pkg6\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '2.0b1' => - array( - 'id' => - "9", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:34:03", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - '1.1' => - array( - 'id' => - "7", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:37", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:4:\"pkg2\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '1.1' => - array( - 'id' => - "3", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:56", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:4:\"pkg3\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '1.4' => - array( - 'id' => - "11", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:51:31", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - ), - '1.1' => - array( - 'id' => - "4", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:06", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:4:\"pkg4\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '1.1' => - array( - 'id' => - "5", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:17", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:4:\"pkg5\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '1.1' => - array( - 'id' => - "6", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:25", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:4:\"pkg1\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '2.0b1' => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - '1.1' => - array( - 'id' => - "2", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:43", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", unserialize("a:3:{i:0;s:12:\"pkg4AndAHalf\";i:1;s:8:\"releases\";i:2;b:1;}"), array( - '1.3' => - array( - 'id' => - "10", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:50:05", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "noreleases", - 1 => - "releases", - 2 => - true, - ), array( - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "pkg1", - 1 => - "releases", - 2 => - true, - ), array( - '2.0b1' => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - '1.1' => - array( - 'id' => - "2", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:43", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "stabilitytoolow", - 1 => - "releases", - 2 => - true, - ), array( - '3.0dev' => - array( - 'id' => - "23", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:38", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - ), - '2.0a1' => - array( - 'id' => - "22", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:19", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - ), - '1.0b1' => - array( - 'id' => - "21", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:42", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - '0.6beta' => - array( - 'id' => - "20", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:36", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - '0.5' => - array( - 'id' => - "19", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:28", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - ), - '0.3' => - array( - 'id' => - "18", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:21", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "pkg6", - 1 => - "releases", - 2 => - true, - ), array( - '2.0b1' => - array( - 'id' => - "9", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:34:03", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - '1.1' => - array( - 'id' => - "7", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:37", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "depnoreleases", - 1 => - "releases", - 2 => - true, - ), array( - '1.0' => - array( - 'id' => - "24", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 17:10:42", - 'releasenotes' => - "dependency has no releases test", - 'state' => - "beta", - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "depunstable", - 1 => - "releases", - 2 => - true, - ), array( - '1.0' => - array( - 'id' => - "26", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 17:32:38", - 'releasenotes' => - "dependency stability is too low", - 'state' => - "stable", - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "stabilitytoolow", - ), array( - 'packageid' => - "9", - 'name' => - "stabilitytoolow", - 'type' => - "pear", - 'categoryid' => - "1", - 'category' => - "Test", - 'stable' => - "3.0dev", - 'license' => - "PHP License", - 'summary' => - "required test for PEAR_Installer", - 'homepage' => - "", - 'description' => - "fake package", - 'cvs_link' => - "", - 'doc_link' => - "", - 'releases' => - array( - '3.0dev' => - array( - 'id' => - "23", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:38", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "pkg6", - 'optional' => - "0", - ), - ), - ), - '2.0a1' => - array( - 'id' => - "22", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:19", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "pkg6", - 'optional' => - "0", - ), - ), - ), - '1.0b1' => - array( - 'id' => - "21", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:42", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "pkg6", - 'optional' => - "0", - ), - ), - ), - '0.6beta' => - array( - 'id' => - "20", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:36", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "pkg6", - 'optional' => - "0", - ), - ), - ), - '0.5' => - array( - 'id' => - "19", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:28", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "pkg6", - 'optional' => - "0", - ), - ), - ), - '0.3' => - array( - 'id' => - "18", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:21", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "pkg6", - 'optional' => - "0", - ), - ), - ), - ), - 'notes' => - array( - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "depnoreleases", - ), array( - 'packageid' => - "10", - 'name' => - "depnoreleases", - 'type' => - "pear", - 'categoryid' => - "1", - 'category' => - "Test", - 'stable' => - "1.0", - 'license' => - "PHP License", - 'summary' => - "required test for PEAR_Installer", - 'homepage' => - "", - 'description' => - "fake package", - 'cvs_link' => - "", - 'doc_link' => - "", - 'releases' => - array( - '1.0' => - array( - 'id' => - "24", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 17:10:42", - 'releasenotes' => - "dependency has no releases test", - 'state' => - "beta", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0", - 'name' => - "noreleases", - 'optional' => - "0", - ), - ), - ), - ), - 'notes' => - array( - ), - )); -$pearweb->addXmlrpcConfig("package.info", array( - 0 => - "depunstable", - ), array( - 'packageid' => - "11", - 'name' => - "depunstable", - 'type' => - "pear", - 'categoryid' => - "1", - 'category' => - "Test", - 'stable' => - "1.0", - 'license' => - "PHP License", - 'summary' => - "required test for PEAR_Installer", - 'homepage' => - "", - 'description' => - "fake package", - 'cvs_link' => - "", - 'doc_link' => - "", - 'releases' => - array( - '1.0' => - array( - 'id' => - "26", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 17:32:38", - 'releasenotes' => - "dependency stability is too low", - 'state' => - "stable", - 'deps' => - array( - 0 => - array( - 'type' => - "pkg", - 'relation' => - "ge", - 'version' => - "1.0b1", - 'name' => - "stabilitytoolow", - 'optional' => - "0", - ), - ), - ), - ), - 'notes' => - array( - ), - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "noreleases", - 2 => - array( - 0 => - "stable", - ), - ), false); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg1", - 2 => - "1976.9.2", - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg1", - 2 => - "snapshot", - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg1", - 2 => - "burgerking", - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "stabilitytoolow", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "3.0dev", - 1 => - array( - 'id' => - "23", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:38", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - ), - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "stabilitytoolow", - 2 => - "3.0dev", - ), array( - 0 => - "3.0dev", - 1 => - array( - 'id' => - "23", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:38", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - ), - 2 => - "http://pear.Chiara/get/stabilitytoolow-3.0dev", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "stabilitytoolow", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "1.0b1", - 1 => - array( - 'id' => - "21", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:26:42", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/stabilitytoolow-1.0b1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "stabilitytoolow", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "2.0a1", - 1 => - array( - 'id' => - "22", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:19", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - ), - 2 => - "http://pear.Chiara/get/stabilitytoolow-2.0a1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "stabilitytoolow", - 2 => - array( - 0 => - "devel", - 1 => - "alpha", - 2 => - "beta", - 3 => - "stable", - ), - ), array( - 0 => - "3.0dev", - 1 => - array( - 'id' => - "23", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 00:27:38", - 'releasenotes' => - "required dependency test", - 'state' => - "devel", - ), - 2 => - "http://pear.Chiara/get/stabilitytoolow-3.0dev", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - array( - 0 => - "devel", - 1 => - "alpha", - 2 => - "beta", - 3 => - "stable", - ), - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "9", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:34:03", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/pkg6-2.0b1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - "1.1", - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "7", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:37", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg6-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "depnoreleases", - 2 => - array( - 0 => - "devel", - 1 => - "alpha", - 2 => - "beta", - 3 => - "stable", - ), - ), array( - 0 => - "1.0", - 1 => - array( - 'id' => - "24", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 17:10:42", - 'releasenotes' => - "dependency has no releases test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/depnoreleases-1.0", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "depunstable", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.0", - 1 => - array( - 'id' => - "26", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-06 17:32:38", - 'releasenotes' => - "dependency stability is too low", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/depunstable-1.0", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "7", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:37", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg6-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - "stable", - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "7", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:37", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg6-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - "beta", - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "9", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:34:03", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/pkg6-2.0b1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "9", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:34:03", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/pkg6-2.0b1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg2", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "3", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:56", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg2-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg3", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "4", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:06", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg3-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg4", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "5", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:17", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg4-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg5", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "6", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:25", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg5-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg1", - 2 => - array( - 0 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "2", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:43", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg1-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg1", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/pkg1-2.0b1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg2", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "3", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:56", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg2-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg3", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "4", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:06", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg3-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg4", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "5", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:17", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg4-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg5", - 2 => - array( - 0 => - "beta", - 1 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "6", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:25", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg5-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg1", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "8", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:29:15", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/pkg1-2.0b1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg2", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "3", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:02:56", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg2-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg3", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "1.4", - 1 => - array( - 'id' => - "11", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:51:31", - 'releasenotes' => - "required dependency test", - 'state' => - "alpha", - ), - 2 => - "http://pear.Chiara/get/pkg3-1.4", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg4AndAHalf", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "1.3", - 1 => - array( - 'id' => - "10", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:50:05", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg4AndAHalf-1.3", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg4", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "5", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:17", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg4-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg5", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "1.1", - 1 => - array( - 'id' => - "6", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 17:03:25", - 'releasenotes' => - "required dependency test", - 'state' => - "stable", - ), - 2 => - "http://pear.Chiara/get/pkg5-1.1", - )); -$pearweb->addXmlrpcConfig("package.getDownloadURL", array( - 0 => - "pear", - 1 => - "pkg6", - 2 => - array( - 0 => - "alpha", - 1 => - "beta", - 2 => - "stable", - ), - ), array( - 0 => - "2.0b1", - 1 => - array( - 'id' => - "9", - 'doneby' => - "cellog", - 'license' => - "", - 'summary' => - "", - 'description' => - "", - 'releasedate' => - "2003-12-03 18:34:03", - 'releasenotes' => - "required dependency test", - 'state' => - "beta", - ), - 2 => - "http://pear.Chiara/get/pkg6-2.0b1", - )); - -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg6-1.1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg6-1.1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg6-2.0b1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg6-2.0b1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg2-1.1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg2-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg2-1.1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg2-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg3-1.1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg3-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg3-1.1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg3-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg4-1.1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg4-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg4-1.1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg4-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg5-1.1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg5-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg5-1.1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg5-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg1-1.1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg1-1.1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-1.1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg1-2.0b1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-2.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg1-2.0b1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-2.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg3-1.4", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg3-1.4.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg3-1.4.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg3-1.4.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg4AndAHalf-1.3", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg4AndAHalf-1.3.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/pkg4AndAHalf-1.3.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg4AndAHalf-1.3.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-0.3", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-0.3.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-0.3.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-0.3.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-0.5", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-0.5.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-0.5.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-0.5.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-0.6beta", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-0.6beta.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-0.6beta.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-0.6beta.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-1.0b1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-1.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-1.0b1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-1.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-2.0a1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-2.0a1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-2.0a1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-2.0a1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-2.0b1", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-2.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-2.0b1.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-2.0b1.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-2.0dev", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-2.0dev.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-2.0dev.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-2.0dev.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-3.0dev", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-3.0dev.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-3.0dev.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-3.0dev.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/depnoreleases-1.0", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'depnoreleases-1.0.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/depnoreleases-1.0.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'depnoreleases-1.0.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/depunstable-1.0", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'depunstable-1.0.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/depunstable-1.0.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'depunstable-1.0.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-3.0dev.tgz'); -$pearweb->addHtmlConfig("http://pear.Chiara/get/stabilitytoolow-3.0dev.tgz", - dirname(__FILE__) . DIRECTORY_SEPARATOR . 'stabilitytoolow-3.0dev.tgz'); -?>
\ No newline at end of file diff --git a/pear/tests/download_test_classes.php.inc b/pear/tests/download_test_classes.php.inc deleted file mode 100644 index 0341a28611..0000000000 --- a/pear/tests/download_test_classes.php.inc +++ /dev/null @@ -1,403 +0,0 @@ -<?php -require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PEAR_test_mock_pearweb.php.inc'; -$GLOBALS['pearweb'] = new PEAR_test_mock_pearweb; -class test_XML_RPC_Client extends XML_RPC_Client { - function test_XML_RPC_Client() - { - $this->_fakepearweb = &$GLOBALS['pearweb']; - } - - function sendPayloadHTTP10($msg, $server, $port, $timeout=0, - $username="", $password="") - { - // Only create the payload if it was not created previously - if(empty($msg->payload)) $msg->createPayload(); - - $resp = $this->_fakepearweb->receiveXmlrpc($msg->payload); - - $resp=$msg->parseResponse($resp); - return $resp; - } -} -require_once 'PEAR/Remote.php'; - -class test_PEAR_Remote extends PEAR_Remote { - var $_pearweb; - var $_fakepearweb = true; - var $_simulateEpi = true; - function test_PEAR_Remote($config) - { - $pearweb = &$GLOBALS['pearweb']; - include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'download_test.config.inc'; - $this->_pearweb = $pearweb; - parent::PEAR_Remote($config); - $this->_pearweb->setRemote($this); - } - - function parentcall() - { - $args = func_get_args(); - $method = array_shift($args); - switch (count($args)) { - case 0: - $result = PEAR_Remote::call_epi($method); - break; - case 1: - $result = PEAR_Remote::call_epi($method, $args[0]); - break; - case 2: - $result = PEAR_Remote::call_epi($method, $args[0], $args[1]); - break; - case 3: - $result = PEAR_Remote::call_epi($method, $args[0], $args[1], $args[2]); - break; - case 4: - $result = PEAR_Remote::call_epi($method, $args[0], $args[1], $args[2], $args[3]); - break; - case 5: - $result = PEAR_Remote::call_epi($method, $args[0], $args[1], $args[2], $args[3], $args[4]); - break; - case 6: - $result = PEAR_Remote::call_epi($method, $args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); - break; - } - return $result; - } - - function call($method) - { - $_args = $args = func_get_args(); - - $server_channel = $this->config->get('default_channel'); - $channel = $this->_registry->getChannel($server_channel); - if ($channel) { - if (!$channel->supports('xml-rpc', $method)) { - // check for channel.list, which is implicitly supported for the PEAR channel - if (!(strtolower($server_channel) == 'pear' && $method == 'channel.list')) { - return $this->raiseError("Channel $server_channel does not support xml-rpc method $method"); - } - } - } - - array_unshift($_args, $channel); // cache by channel - $this->cache = $this->getCache($_args); - $cachettl = $this->config->get('cache_ttl'); - // If cache is newer than $cachettl seconds, we use the cache! - if ($this->cache !== null && $this->cache['age'] < $cachettl) { - return $this->cache['content']; - }; - if ($this->_simulateEpi) { - $result = call_user_func_array(array(&$this, 'call_epi'), $args); - if (!PEAR::isError($result)) { - $this->saveCache($_args, $result); - }; - return $result; - } - if (!extension_loaded("xmlrpc")) { - return $this->raiseError("For this remote PEAR operation you need to install the xmlrpc extension"); - } - array_shift($args); - $server_host = $this->_registry->channelInfo($server_channel, 'server'); - $username = $this->config->get('username'); - $password = $this->config->get('password'); - $eargs = array(); - foreach($args as $arg) $eargs[] = $this->_encode($arg); - $f = new XML_RPC_Message($method, $eargs); - if ($this->cache !== null) { - $maxAge = '?maxAge='.$this->cache['lastChange']; - } else { - $maxAge = ''; - }; - $proxy_host = $proxy_port = $proxy_user = $proxy_pass = ''; - if ($proxy = parse_url($this->config->get('http_proxy'))) { - $proxy_host = @$proxy['host']; - $proxy_port = @$proxy['port']; - $proxy_user = @$proxy['user']; - $proxy_pass = @$proxy['pass']; - } - $c = new test_XML_RPC_Client('/xmlrpc.php'.$maxAge, $server_host, 80, $proxy_host, $proxy_port, $proxy_user, $proxy_pass); - if ($username && $password) { - $c->setCredentials($username, $password); - } - if ($this->config->get('verbose') >= 3) { - $c->setDebug(1); - } - $r = $c->send($f); - if (!$r) { - return $this->raiseError("XML_RPC send failed"); - } - $v = $r->value(); - if ($e = $r->faultCode()) { - if ($e == $GLOBALS['XML_RPC_err']['http_error'] && strstr($r->faultString(), '304 Not Modified') !== false) { - return $this->cache['content']; - } - return $this->raiseError($r->faultString(), $e); - } - - $result = XML_RPC_decode($v); - $this->saveCache($_args, $result); - return $result; - } - - function call_epi($method) - { - $args = func_get_args(); - array_shift($args); - if ($this->_fakepearweb) { - if (count($args)) { - $result = $this->_pearweb->call($method, $args); - } else { - $result = $this->_pearweb->call($method); - } - }/* else { - switch (count($args)) { - case 0: - $result = parent::call($method); - break; - case 1: - $result = parent::call($method, $args[0]); - break; - case 2: - $result = parent::call($method, $args[0], $args[1]); - break; - case 3: - $result = parent::call($method, $args[0], $args[1], $args[2]); - break; - case 4: - $result = parent::call($method, $args[0], $args[1], $args[2], $args[3]); - break; - case 5: - $result = parent::call($method, $args[0], $args[1], $args[2], $args[3], $args[4]); - break; - case 6: - $result = parent::call($method, $args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); - break; - } - }*/ - if (PEAR::isError($result)) { - return $result; - } - return $result; - } -} - -require_once 'PEAR/Installer.php'; -class test_PEAR_Installer extends PEAR_Installer { - function download($packages, $options, &$config, &$installpackages, - &$errors, $installed = false, $willinstall = false, $state = false) - { - // trickiness: initialize here - $this->PEAR_Downloader($this->ui, $options, $config); - $this->_remote = &new test_PEAR_Remote($config); - $ret = PEAR_Downloader::download($packages); - $errors = $this->getErrorMsgs(); - $installpackages = $this->getDownloadedPackages(); - trigger_error("PEAR Warning: PEAR_Installer::download() is deprecated " . - "in favor of PEAR_Downloader class", E_USER_WARNING); - return $ret; - } - - function downloadHttp($url, &$ui, $save_dir = '.', $callback = null) - { -// return parent::downloadHttp($url, $ui, $save_dir, $callback); - if ($callback) { - call_user_func($callback, 'setup', array(&$ui)); - } - if (preg_match('!^http://([^/:?#]*)(:(\d+))?(/.*)!', $url, $matches)) { - list(,$host,,$port,$path) = $matches; - } - if (isset($this)) { - $config = &$this->config; - } else { - $config = &PEAR_Config::singleton(); - } - $proxy_host = $proxy_port = $proxy_user = $proxy_pass = ''; - if ($proxy = parse_url($config->get('http_proxy'))) { - $proxy_host = @$proxy['host']; - $proxy_port = @$proxy['port']; - $proxy_user = @$proxy['user']; - $proxy_pass = @$proxy['pass']; - - if ($proxy_port == '') { - $proxy_port = 8080; - } - if ($callback) { - call_user_func($callback, 'message', "Using HTTP proxy $host:$port"); - } - } - if (empty($port)) { - $port = 80; - } - // use _pearweb to get file - $retrieved = explode("\n", $this->_remote->_pearweb->receiveHttp($url)); - $headers = array(); - $line = array_shift($retrieved); - while (strlen(trim($line))) { - if (preg_match('/^([^:]+):\s+(.*)\s*$/', $line, $matches)) { - $headers[strtolower($matches[1])] = trim($matches[2]); - } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) { - if ($matches[1] != 200) { - return PEAR::raiseError("File http://$host:$port$path not valid (received: $line)"); - } - } - $line = array_shift($retrieved); - } - $retrieved = join("\n", $retrieved); - if (isset($headers['content-disposition']) && - preg_match('/\sfilename=\"([^;]*\S)\"\s*(;|$)/', $headers['content-disposition'], $matches)) { - $save_as = basename($matches[1]); - } else { - $save_as = basename($url); - } - if ($callback) { - $tmp = call_user_func($callback, 'saveas', $save_as); - if ($tmp) { - $save_as = $tmp; - } - } - $dest_file = $save_dir . DIRECTORY_SEPARATOR . $save_as; - if (!$wp = @fopen($dest_file, 'wb')) { - fclose($fp); - if ($callback) { - call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg)); - } - return PEAR::raiseError("could not open $dest_file for writing"); - } - if (isset($headers['content-length'])) { - $length = $headers['content-length']; - } else { - $length = -1; - } - $bytes = 0; - if ($callback) { - call_user_func($callback, 'start', array(basename($dest_file), $length)); - } - $start = 0; - while ($start < strlen($retrieved) - 1) { - $data = substr($retrieved, $start, 1024); - $start += 1024; - $bytes += strlen($data); - if ($callback) { - call_user_func($callback, 'bytesread', $bytes); - } - if (!@fwrite($wp, $data)) { - if ($callback) { - call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg)); - } - return PEAR::raiseError("$dest_file: write failed ($php_errormsg)"); - } - } - fclose($wp); - if ($callback) { - call_user_func($callback, 'done', $bytes); - } - return $dest_file; - } -} - -require_once 'PEAR/Downloader.php'; -class test_PEAR_Downloader extends PEAR_Downloader { - function test_PEAR_Downloader(&$ui, $options, &$config) - { - parent::PEAR_Downloader($ui, $options, $config); - $this->_remote = new test_PEAR_Remote($config); - } - - function downloadHttp($url, &$ui, $save_dir = '.', $callback = null) - { -// return parent::downloadHttp($url, $ui, $save_dir, $callback); - if ($callback) { - call_user_func($callback, 'setup', array(&$ui)); - } - if (preg_match('!^http://([^/:?#]*)(:(\d+))?(/.*)!', $url, $matches)) { - list(,$host,,$port,$path) = $matches; - } - if (isset($this)) { - $config = &$this->config; - } else { - $config = &PEAR_Config::singleton(); - } - $proxy_host = $proxy_port = $proxy_user = $proxy_pass = ''; - if ($proxy = parse_url($config->get('http_proxy'))) { - $proxy_host = @$proxy['host']; - $proxy_port = @$proxy['port']; - $proxy_user = @$proxy['user']; - $proxy_pass = @$proxy['pass']; - - if ($proxy_port == '') { - $proxy_port = 8080; - } - if ($callback) { - call_user_func($callback, 'message', "Using HTTP proxy $host:$port"); - } - } - if (empty($port)) { - $port = 80; - } - // use _pearweb to get file - $retrieved = explode("\n", $this->_remote->_pearweb->receiveHttp($url)); - $headers = array(); - $line = array_shift($retrieved); - while (strlen(trim($line))) { - if (preg_match('/^([^:]+):\s+(.*)\s*$/', $line, $matches)) { - $headers[strtolower($matches[1])] = trim($matches[2]); - } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) { - if ($matches[1] != 200) { - return PEAR::raiseError("File http://$host:$port$path not valid (received: $line)"); - } - } - $line = array_shift($retrieved); - } - $retrieved = join("\n", $retrieved); - if (isset($headers['content-disposition']) && - preg_match('/\sfilename=\"([^;]*\S)\"\s*(;|$)/', $headers['content-disposition'], $matches)) { - $save_as = basename($matches[1]); - } else { - $save_as = basename($url); - } - if ($callback) { - $tmp = call_user_func($callback, 'saveas', $save_as); - if ($tmp) { - $save_as = $tmp; - } - } - $dest_file = $save_dir . DIRECTORY_SEPARATOR . $save_as; - if (!$wp = @fopen($dest_file, 'wb')) { - fclose($fp); - if ($callback) { - call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg)); - } - return PEAR::raiseError("could not open $dest_file for writing"); - } - if (isset($headers['content-length'])) { - $length = $headers['content-length']; - } else { - $length = -1; - } - $bytes = 0; - if ($callback) { - call_user_func($callback, 'start', array(basename($dest_file), $length)); - } - $start = 0; - while ($start < strlen($retrieved) - 1) { - $data = substr($retrieved, $start, 1024); - $start += 1024; - $bytes += strlen($data); - if ($callback) { - call_user_func($callback, 'bytesread', $bytes); - } - if (!@fwrite($wp, $data)) { - if ($callback) { - call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg)); - } - return PEAR::raiseError("$dest_file: write failed ($php_errormsg)"); - } - } - fclose($wp); - if ($callback) { - call_user_func($callback, 'done', $bytes); - } - return $dest_file; - } -} -?> 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/merge2.input b/pear/tests/merge2.input deleted file mode 100644 index 853a6d10bb..0000000000 --- a/pear/tests/merge2.input +++ /dev/null @@ -1 +0,0 @@ -a:2:{s:7:"verbose";i:35;s:10:"__channels";a:2:{s:5:"test1";a:1:{s:7:"verbose";i:898;}s:5:"test2";a:1:{s:7:"verbose";i:899;}}}
\ No newline at end of file diff --git a/pear/tests/package-PEARtests.xml b/pear/tests/package-PEARtests.xml deleted file mode 100644 index d4e9113fe6..0000000000 --- a/pear/tests/package-PEARtests.xml +++ /dev/null @@ -1,176 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>PEARtests</name> - <summary>PEAR Base System tests</summary> - <description>This package contains all tests for the PEAR base system</description> - <maintainers> - <maintainer> - <user>cellog</user> - <name>Greg Beaver</name> - <email>cellog@php.net</email> - <role>developer</role> - </maintainer> - </maintainers> - <release> - <version>2.1</version> - <date>2004-06-04</date> - <license>PHP License</license> - <state>stable</state> - <notes>Installation package.xml for PEAR package tests</notes> - <deps> - <dep type="pkg" rel="ge" version="1.4.0dev6">PEAR</dep> - <dep type="pkg" rel="ge" version="1.1">Archive_Tar</dep> - <dep type="pkg" rel="ge" version="1.2">Console_Getopt</dep> - <dep type="ext" rel="has">xmlrpc</dep> - <dep type="ext" rel="has">xml</dep> - <dep type="ext" rel="has">pcre</dep> - </deps> - <filelist> - <dir baseinstalldir="PEAR" name="/"> - <dir name="dirtree"> - <file role="test" name="package-fail.xml"/> - <file role="test" name="package.xml"/> - <file role="test" name="package2.xml"/> - <file role="test" name="pkg1-1.0.tgz"/> - <file role="test" name="pkg2-1.0.tgz"/> - <dir name="multiplepackages"> - <file role="test" name="pkg1file.php"/> - <file role="test" name="pkg2file.php"/> - </dir> <!-- dirtree/multiplepackages --> - <dir name="nestedroot"> - <file role="test" name="rootfile.php"/> - <dir name="emptydir"> - <file role="test" name="fakefile1.php"/> - <dir name="nesteddir"> - <file role="test" name="nestedfile.php"/> - </dir> <!-- dirtree/nestedroot/emptydir/nesteddir --> - </dir> <!-- dirtree/nestedroot/emptydir --> - </dir> <!-- dirtree/nestedroot --> - <dir name="pkg1"> - <file role="test" name="randomfile.php"/> - </dir> <!-- dirtree/pkg1 --> - </dir> <!-- dirtree --> - <dir name="PEAR_ErrorStack"> - <file role="test" name="base_regression.php"/> - <file role="test" name="Error_Stack_TestCase_getErrorMessage.php"/> - <file role="test" name="Error_Stack_TestCase_getErrorMessageTemplate.php"/> - <file role="test" name="Error_Stack_TestCase_getErrors.php"/> - <file role="test" name="Error_Stack_TestCase_pushpop.php"/> - <file role="test" name="Error_Stack_TestCase_pushpopcallback.php"/> - <file role="test" name="Error_Stack_TestCase_pushpopstatic.php"/> - <file role="test" name="Error_Stack_TestCase_singleton.php"/> - <file role="test" name="Error_Stack_TestCase_staticGetErrors.php"/> - <file role="test" name="HTML_TestListener.php"/> - <file role="test" name="stylesheet.css"/> - <file role="test" name="testsuite.php"/> - <file role="test" name="TestUnit.php"/> - </dir> <!-- PEAR_ErrorStack --> - <dir name="test-pkg6"> - <file role="test" name="conflictpackage2.xml"/> - <file role="test" name="conflictpackage.xml"/> - <file role="test" name="invalidtgz.tgz"/> - <file role="test" name="nopackagexml.tgz"/> - <file role="test" name="package2.xml"/> - <file role="test" name="package2_invalid.xml"/> - <file role="test" name="package.xml"/> - <file role="test" name="pkg6-1.1.tgz"/> - <file role="test" name="pkg6-2.0b1.tgz"/> - <file role="test" name="zoorb.php"/> - <dir name="goompness"> - <file role="test" name="Mopreeb.php"/> - <file role="test" name="oggbrzitzkee.php"/> - <file role="test" name="test.dat"/> - </dir> <!-- test-pkg6/goompness --> - </dir> <!-- test-pkg6 --> - <file role="test" name="common_sortPkgDeps1_package.xml"/> - <file role="test" name="common_sortPkgDeps2_package.xml"/> - <file role="test" name="common_sortPkgDeps3_package.xml"/> - <file role="test" name="common_sortPkgDeps4_package.xml"/> - <file role="test" name="common_sortPkgDeps5_package.xml"/> - <file role="test" name="common_sortPkgDeps6_package.xml"/> - <file role="test" name="depnoreleases-1.0.tgz"/> - <file role="test" name="depunstable-1.0.tgz"/> - <file role="test" name="download_test.config.inc"/> - <file role="test" name="download_test_classes.php.inc"/> - <file role="test" name="merge.input"/> - <file role="test" name="merge2.input"/> - <file role="test" name="pear1.phpt"/> - <file role="test" name="pear2.phpt"/> - <file role="test" name="pear_autoloader.phpt"/> - <file role="test" name="pear_channelfile.phpt"/> - <file role="test" name="pear_common_analyzeSC.phpt"/> - <file role="test" name="pear_common_buildProvidesArray.phpt"/> - <file role="test" name="pear_common_downloadHttp.phpt"/> - <file role="test" name="pear_common_infoFromString.phpt"/> - <file role="test" name="pear_common_sortPkgDeps.phpt"/> - <file role="test" name="pear_common_validPackageVersion.phpt"/> - <file role="test" name="pear_config.phpt"/> - <file role="test" name="pear_config_1.1.phpt"/> - <file role="test" name="pear_dependency_checkExtension.phpt"/> - <file role="test" name="pear_dependency_checkPackage.phpt"/> - <file role="test" name="pear_dependency_checkPackageUninstall.phpt"/> - <file role="test" name="pear_downloader_invalid.phpt"/> - <file role="test" name="pear_downloader_new.phpt"/> - <file role="test" name="pear_downloader_old.phpt"/> - <file role="test" name="pear_error.phpt"/> - <file role="test" name="pear_error2.phpt"/> - <file role="test" name="pear_error3.phpt"/> - <file role="test" name="pear_error4.phpt"/> - <file role="test" name="pear_installer1.phpt"/> - <file role="test" name="pear_installer2.phpt"/> - <file role="test" name="pear_installer3.phpt"/> - <file role="test" name="pear_installer4.phpt"/> - <file role="test" name="pear_installer5.phpt"/> - <file role="test" name="pear_installer_installFile_channels.phpt"/> - <file role="test" name="pear_installer_install_channels.phpt"/> - <file role="test" name="pear_packager.phpt"/> - <file role="test" name="pear_registry_inc.php.inc"/> - <file role="test" name="pear_registry.phpt"/> - <file role="test" name="pear_registry_1.1.phpt"/> - <file role="test" name="pear_system.phpt"/> - <file role="test" name="PEAR_test_mock_pearweb.php.inc"/> - <file role="test" name="php.ini"/> - <file role="test" name="php_dump.php.inc"/> - <file role="test" name="pkg1-1.1.tgz"/> - <file role="test" name="pkg1-2.0b1.tgz"/> - <file role="test" name="pkg2-1.1.tgz"/> - <file role="test" name="pkg3-1.1.tgz"/> - <file role="test" name="pkg3-1.4.tgz"/> - <file role="test" name="pkg4-1.1.tgz"/> - <file role="test" name="pkg4AndAHalf-1.3.tgz"/> - <file role="test" name="pkg5-1.1.tgz"/> - <file role="test" name="stabilitytoolow-0.3.tgz"/> - <file role="test" name="stabilitytoolow-0.5.tgz"/> - <file role="test" name="stabilitytoolow-0.6beta.tgz"/> - <file role="test" name="stabilitytoolow-1.0b1.tgz"/> - <file role="test" name="stabilitytoolow-2.0a1.tgz"/> - <file role="test" name="stabilitytoolow-2.0b1.tgz"/> - <file role="test" name="stabilitytoolow-2.0dev.tgz"/> - <file role="test" name="stabilitytoolow-3.0dev.tgz"/> - <file role="test" name="system.input"/> - <file role="test" name="testdownload.tgz"/> - <file role="test" name="toonew.conf"/> - <file role="test" name="user.input"/> - <file role="test" name="user2.input"/> - <file role="test" name="user3.input"/> - </dir> <!-- / --> - </filelist> - </release> - <changelog> - <release> - <version>1.0</version> - <date>2004-03-21</date> - <license>PHP License</license> - <state>stable</state> - <notes>Installation package.xml for PEAR package tests</notes> - </release> - <release> - <version>2.0</version> - <date>2004-06-01</date> - <license>PHP License</license> - <state>stable</state> - <notes>Installation package.xml for PEAR package tests</notes> - </release> - </changelog> -</package> diff --git a/pear/tests/pear1.phpt b/pear/tests/pear1.phpt deleted file mode 100644 index f65d6a4f19..0000000000 --- a/pear/tests/pear1.phpt +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -PEAR constructor/destructor test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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"; - -?> ---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 ccf8864ef2..0000000000 --- a/pear/tests/pear2.phpt +++ /dev/null @@ -1,850 +0,0 @@ ---TEST-- -PEAR complete set/push/pop error-handling test (run from pear/tests dir) ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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(); - -?> ---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_channelfile.phpt b/pear/tests/pear_channelfile.phpt deleted file mode 100644 index 838c57fbcb..0000000000 --- a/pear/tests/pear_channelfile.phpt +++ /dev/null @@ -1,1545 +0,0 @@ ---TEST-- -PEAR_Channelfile ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -error_reporting(E_ALL); -chdir(dirname(__FILE__)); -include "PEAR/Channelfile.php"; -require_once 'PEAR/ErrorStack.php'; - -function logStack($err) -{ - echo "caught Error Stack error:\n"; - echo $err['message'] . "\n"; - echo 'code : ' . $err['code'] . "\n"; -} -PEAR_ErrorStack::setDefaultCallback('logStack'); -echo "test default\n"; -$chf = new PEAR_ChannelFile; -$chf->fromXmlString('<?xml version="1.0" encoding="ISO-8859-1" ?> -<channel version="1.0"> - <name>PEAR5</name> -<summary>PEAR packages for PHP 5</summary> -<server>pear.php.net</server> -<subchannels> -<subchannel name="PEAR5.qa"> -<server>qa.pear.php.net</server> -<summary>Quality Assurance releases of unmaintained packages</summary> -<deps><dep type="pkg" rel="ge" version="1.4">PEAR</dep> -<dep type="php" rel="ge" version="5.0.0"/></deps> -</subchannel> -<subchannel name="pear.boo"> -<server>boo.pear.php.net</server> -<summary>booya</summary> -<deps><dep type="pkg" rel="ge" version="1.5">PEAR</dep> -<dep type="php" rel="ge" version="5.1.0"/></deps> -</subchannel> -</subchannels> -<deps> - <dep type="php" rel="ge" version="5.0.0"/> -</deps> -</channel>'); - -echo "after parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); -$chf->fromXmlString($chf->toXml()); - -echo "after re-parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); - -echo "test compatibility\n"; -$chf = new PEAR_ChannelFile(true); -$chf->fromXmlString('<?xml version="1.0" encoding="ISO-8859-1" ?> -<channel version="1.0"> - <name>PEAR5</name> -<summary>PEAR packages for PHP 5</summary> -<server>pear.php.net</server> -<subchannels> -<subchannel name="PEAR5.qa"> -<server>qa.pear.php.net</server> -<summary>Quality Assurance releases of unmaintained packages</summary> -<deps><dep type="pkg" rel="ge" version="1.4">PEAR</dep> -<dep type="php" rel="ge" version="5.0.0"/></deps> -</subchannel> -<subchannel name="pear.boo"> -<server>boo.pear.php.net</server> -<summary>booya</summary> -<deps><dep type="pkg" rel="ge" version="1.5">PEAR</dep> -<dep type="php" rel="ge" version="5.1.0"/></deps> -</subchannel> -</subchannels> -<deps> - <dep type="php" rel="ge" version="5.0.0"/> -</deps> -</channel>'); - -echo "after parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); -$chf->fromXmlString($chf->toXml()); - -echo "after re-parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); - -echo "\ntest add packagenameregex\n"; -$chf->setPackageNameRegex('[A-Z]+'); -var_dump($chf->toArray()); -var_dump($chf->toXml()); -$chf->fromXmlString($chf->toXml()); - -echo "after re-parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); - -echo "\ntest add protocols\n"; -$chf->addProtocol('xml-rpc', '1.0', 'package.listall'); -$chf->addProtocol('xml-rpc', '1.0', 'release.list'); -$chf->addProtocol('get', '1.0'); -var_dump($chf->toArray()); -var_dump($chf->toXml()); -$chf->fromXmlString($chf->toXml()); - -echo "after re-parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); - -echo "\ntest add mirror\n"; -$chf->addMirror('server', 'mirror.php.net'); -$chf->addMirrorProtocol('mirror.php.net', 'xml-rpc', '1.0', 'package.listall'); -$chf->addMirrorProtocol('mirror.php.net', 'xml-rpc', '1.0', 'release.list'); -var_dump($chf->toArray()); -var_dump($chf->toXml()); -$chf->fromXmlString($chf->toXml()); - -echo "after re-parsing\n"; -var_dump($chf->validate()); -var_dump($chf->toArray()); -var_dump($chf->toXml()); -?> ---EXPECT-- -test default -after parsing -bool(true) -array(6) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(823) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" -after re-parsing -bool(true) -array(6) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(823) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" -test compatibility -after parsing -bool(true) -array(6) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(823) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" -after re-parsing -bool(true) -array(6) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(823) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" - -test add packagenameregex -array(7) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - ["packagenameregex"]=> - string(6) "[A-Z]+" -} -string(868) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <packagenameregex>[A-Z]+</packagenameregex> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" -after re-parsing -bool(true) -array(7) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["packagenameregex"]=> - string(6) "[A-Z]+" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(868) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <packagenameregex>[A-Z]+</packagenameregex> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" - -test add protocols -array(8) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["packagenameregex"]=> - string(6) "[A-Z]+" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - ["provides"]=> - array(3) { - [1]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(15) "package.listall" - } - [2]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(12) "release.list" - } - [3]=> - array(2) { - ["type"]=> - string(3) "get" - ["version"]=> - string(3) "1.0" - } - } -} -string(1065) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <provides> - <protocol type="xml-rpc" version="1.0">package.listall</protocol> - <protocol type="xml-rpc" version="1.0">release.list</protocol> - <protocol type="get" version="1.0"/> - </provides> - <packagenameregex>[A-Z]+</packagenameregex> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" -after re-parsing -bool(true) -array(8) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["provides"]=> - array(3) { - [1]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(15) "package.listall" - } - [2]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(12) "release.list" - } - [3]=> - array(2) { - ["type"]=> - string(3) "get" - ["version"]=> - string(3) "1.0" - } - } - ["packagenameregex"]=> - string(6) "[A-Z]+" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(1065) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <provides> - <protocol type="xml-rpc" version="1.0">package.listall</protocol> - <protocol type="xml-rpc" version="1.0">release.list</protocol> - <protocol type="get" version="1.0"/> - </provides> - <packagenameregex>[A-Z]+</packagenameregex> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" - -test add mirror -array(9) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["provides"]=> - array(3) { - [1]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(15) "package.listall" - } - [2]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(12) "release.list" - } - [3]=> - array(2) { - ["type"]=> - string(3) "get" - ["version"]=> - string(3) "1.0" - } - } - ["packagenameregex"]=> - string(6) "[A-Z]+" - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - ["mirrors"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(6) "server" - ["name"]=> - string(14) "mirror.php.net" - ["provides"]=> - array(2) { - [1]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(15) "package.listall" - } - [2]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(12) "release.list" - } - } - } - } -} -string(1313) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <provides> - <protocol type="xml-rpc" version="1.0">package.listall</protocol> - <protocol type="xml-rpc" version="1.0">release.list</protocol> - <protocol type="get" version="1.0"/> - </provides> - <packagenameregex>[A-Z]+</packagenameregex> - <mirrors> - <mirror type="server" name="mirror.php.net"> - <provides> - <protocol type="xml-rpc" version="1.0">package.listall</protocol> - <protocol type="xml-rpc" version="1.0">release.list</protocol> - </provides> - </mirror> - </mirrors> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -" -after re-parsing -bool(true) -array(9) { - ["version"]=> - string(3) "1.0" - ["name"]=> - string(5) "pear5" - ["summary"]=> - string(23) "PEAR packages for PHP 5" - ["server"]=> - string(12) "pear.php.net" - ["provides"]=> - array(3) { - [1]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(15) "package.listall" - } - [2]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(12) "release.list" - } - [3]=> - array(2) { - ["type"]=> - string(3) "get" - ["version"]=> - string(3) "1.0" - } - } - ["packagenameregex"]=> - string(6) "[A-Z]+" - ["mirrors"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(6) "server" - ["name"]=> - string(14) "mirror.php.net" - ["provides"]=> - array(2) { - [1]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(15) "package.listall" - } - [2]=> - array(3) { - ["type"]=> - string(7) "xml-rpc" - ["version"]=> - string(3) "1.0" - ["name"]=> - string(12) "release.list" - } - } - } - } - ["subchannels"]=> - array(2) { - [1]=> - array(4) { - ["name"]=> - string(8) "pear5.qa" - ["server"]=> - string(15) "qa.pear.php.net" - ["summary"]=> - string(51) "Quality Assurance releases of unmaintained packages" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.4" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } - } - [2]=> - array(4) { - ["name"]=> - string(8) "pear.boo" - ["server"]=> - string(16) "boo.pear.php.net" - ["summary"]=> - string(5) "booya" - ["deps"]=> - array(2) { - [1]=> - array(4) { - ["type"]=> - string(3) "pkg" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(3) "1.5" - ["name"]=> - string(4) "PEAR" - } - [2]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.1.0" - } - } - } - } - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } -} -string(1313) "<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/channel-1.0"> -<channel version="1.0"> - <name>pear5</name> - <summary>PEAR packages for PHP 5</summary> - <server>pear.php.net</server> - <provides> - <protocol type="xml-rpc" version="1.0">package.listall</protocol> - <protocol type="xml-rpc" version="1.0">release.list</protocol> - <protocol type="get" version="1.0"/> - </provides> - <packagenameregex>[A-Z]+</packagenameregex> - <mirrors> - <mirror type="server" name="mirror.php.net"> - <provides> - <protocol type="xml-rpc" version="1.0">package.listall</protocol> - <protocol type="xml-rpc" version="1.0">release.list</protocol> - </provides> - </mirror> - </mirrors> - <subchannels> - <subchannel name="pear5.qa" server="qa.pear.php.net"> - <summary>Quality Assurance releases of unmaintained packages</summary> - <deps> - <dep type="pkg" rel="ge" version="1.4">PEAR</dep> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> - </subchannel> - <subchannel name="pear.boo" server="boo.pear.php.net"> - <summary>booya</summary> - <deps> - <dep type="pkg" rel="ge" version="1.5">PEAR</dep> - <dep type="php" rel="ge" version="5.1.0"/> - </deps> - </subchannel> - </subchannels> - <deps> - <dep type="php" rel="ge" version="5.0.0"/> - </deps> -</channel> -"
\ No newline at end of file diff --git a/pear/tests/pear_common_analyzeSC.phpt b/pear/tests/pear_common_analyzeSC.phpt deleted file mode 100644 index 0c15a66c8d..0000000000 --- a/pear/tests/pear_common_analyzeSC.phpt +++ /dev/null @@ -1,165 +0,0 @@ ---TEST-- -PEAR_Common::analyzeSourceCode test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -if (!function_exists('token_get_all')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -require_once "PEAR/Common.php"; - -$x = PEAR_Common::analyzeSourceCode('=+"\\//452'); -echo "first test: returns false with non-existing filename? "; -echo $x ? "no\n" : "yes\n"; - -$testdir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pear_common_analyzeSCtest'; -mkdir($testdir); - -$test1 = ' -<?php -::error(); -?> -'; -$fp = fopen($testdir . DIRECTORY_SEPARATOR . 'test1.php', 'w'); -fwrite($fp, $test1); -fclose($fp); - -$ret = PEAR_Common::analyzeSourceCode($testdir . DIRECTORY_SEPARATOR . 'test1.php'); -echo "second test: returns false with invalid PHP? "; -echo $ret ? "no\n" : "yes\n"; -unlink($testdir . DIRECTORY_SEPARATOR . 'test1.php'); - -$test3 = ' -<?php -class test -{ - class test2 { - } -} -?> -'; -$fp = fopen($testdir . DIRECTORY_SEPARATOR . 'test3.php', 'w'); -fwrite($fp, $test3); -fclose($fp); - -$ret = PEAR_Common::analyzeSourceCode($testdir . DIRECTORY_SEPARATOR . 'test3.php'); -echo "fourth test: returns false with invalid PHP? "; -echo $ret ? "no\n" : "yes\n"; -unlink($testdir . DIRECTORY_SEPARATOR . 'test3.php'); - -$test4 = ' -<?php -function test() -{ - class test2 { - } -} -?> -'; -$fp = fopen($testdir . DIRECTORY_SEPARATOR . 'test4.php', 'w'); -fwrite($fp, $test4); -fclose($fp); - -$ret = PEAR_Common::analyzeSourceCode($testdir . DIRECTORY_SEPARATOR . 'test4.php'); -echo "fifth test: returns false with invalid PHP? "; -echo $ret ? "no\n" : "yes\n"; -unlink($testdir . DIRECTORY_SEPARATOR . 'test4.php'); - -$test5 = ' -<?php -function test() -{ -} - -if (trytofool) { - function fool() - { - } -} -class test2 { - function test2() { - parent::unused(); - Greg::classes(); - $a = new Pierre; - } -} - -class blah extends test2 { - /** - * @nodep Stig - */ - function blah() - { - Stig::rules(); - } -} -?> -'; -$fp = fopen($testdir . DIRECTORY_SEPARATOR . 'test5.php', 'w'); -fwrite($fp, $test5); -fclose($fp); - -$ret = PEAR_Common::analyzeSourceCode($testdir . DIRECTORY_SEPARATOR . 'test5.php'); -echo "sixth test: returns false with valid PHP? "; -echo $ret ? "no\n" : "yes\n"; -$ret['source_file'] = str_replace(array(dirname(__FILE__),DIRECTORY_SEPARATOR), array('', '/'), $ret['source_file']); -var_dump($ret); -unlink($testdir . DIRECTORY_SEPARATOR . 'test5.php'); - -rmdir($testdir); -?> ---EXPECT-- -first test: returns false with non-existing filename? yes -second test: returns false with invalid PHP? yes -fourth test: returns false with invalid PHP? yes -fifth test: returns false with invalid PHP? yes -sixth test: returns false with valid PHP? no -array(6) { - ["source_file"]=> - string(36) "/pear_common_analyzeSCtest/test5.php" - ["declared_classes"]=> - array(2) { - [0]=> - string(5) "test2" - [1]=> - string(4) "blah" - } - ["declared_methods"]=> - array(2) { - ["test2"]=> - array(1) { - [0]=> - string(5) "test2" - } - ["blah"]=> - array(1) { - [0]=> - string(4) "blah" - } - } - ["declared_functions"]=> - array(2) { - [0]=> - string(4) "test" - [1]=> - string(4) "fool" - } - ["used_classes"]=> - array(2) { - [0]=> - string(4) "Greg" - [1]=> - string(6) "Pierre" - } - ["inheritance"]=> - array(1) { - ["blah"]=> - string(5) "test2" - } -}
\ No newline at end of file diff --git a/pear/tests/pear_common_buildProvidesArray.phpt b/pear/tests/pear_common_buildProvidesArray.phpt deleted file mode 100644 index 574ed4465c..0000000000 --- a/pear/tests/pear_common_buildProvidesArray.phpt +++ /dev/null @@ -1,152 +0,0 @@ ---TEST-- -PEAR_Common::buildProvidesArray test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -if (!function_exists('token_get_all')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -require_once "PEAR/Common.php"; - -$testdir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pear_common_buildProvidesArraytest'; -mkdir($testdir); - -$test5 = ' -<?php -function test() -{ -} - -if (trytofool) { - function fool() - { - } -} -class test2 { - function test2() { - parent::unused(); - Greg::classes(); - $a = new Pierre; - } -} - -class blah extends test2 { - /** - * @nodep Stig - */ - function blah() - { - Stig::rules(); - } -} -?> -'; -$fp = fopen($testdir . DIRECTORY_SEPARATOR . 'test5.php', 'w'); -fwrite($fp, $test5); -fclose($fp); - -$ret = PEAR_Common::analyzeSourceCode($testdir . DIRECTORY_SEPARATOR . 'test5.php'); -echo "pre-test: returns false with valid PHP? "; -echo $ret ? "no\n" : "yes\n"; -$ret['source_file'] = str_replace(array(dirname(__FILE__),DIRECTORY_SEPARATOR), array('', '/'), $ret['source_file']); -var_dump($ret); -unlink($testdir . DIRECTORY_SEPARATOR . 'test5.php'); -$common = new PEAR_Common; -$common->buildProvidesArray($ret); -var_dump($common->pkginfo); -rmdir($testdir); -?> ---EXPECT-- -pre-test: returns false with valid PHP? no -array(6) { - ["source_file"]=> - string(45) "/pear_common_buildProvidesArraytest/test5.php" - ["declared_classes"]=> - array(2) { - [0]=> - string(5) "test2" - [1]=> - string(4) "blah" - } - ["declared_methods"]=> - array(2) { - ["test2"]=> - array(1) { - [0]=> - string(5) "test2" - } - ["blah"]=> - array(1) { - [0]=> - string(4) "blah" - } - } - ["declared_functions"]=> - array(2) { - [0]=> - string(4) "test" - [1]=> - string(4) "fool" - } - ["used_classes"]=> - array(2) { - [0]=> - string(4) "Greg" - [1]=> - string(6) "Pierre" - } - ["inheritance"]=> - array(1) { - ["blah"]=> - string(5) "test2" - } -} -array(1) { - ["provides"]=> - array(4) { - ["class;test2"]=> - array(3) { - ["file"]=> - string(9) "test5.php" - ["type"]=> - string(5) "class" - ["name"]=> - string(5) "test2" - } - ["class;blah"]=> - array(4) { - ["file"]=> - string(9) "test5.php" - ["type"]=> - string(5) "class" - ["name"]=> - string(4) "blah" - ["extends"]=> - string(5) "test2" - } - ["function;test"]=> - array(3) { - ["file"]=> - string(9) "test5.php" - ["type"]=> - string(8) "function" - ["name"]=> - string(4) "test" - } - ["function;fool"]=> - array(3) { - ["file"]=> - string(9) "test5.php" - ["type"]=> - string(8) "function" - ["name"]=> - string(4) "fool" - } - } -}
\ No newline at end of file diff --git a/pear/tests/pear_common_downloadHttp.phpt b/pear/tests/pear_common_downloadHttp.phpt deleted file mode 100644 index 86f7cc2bf9..0000000000 --- a/pear/tests/pear_common_downloadHttp.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -PEAR_Common::downloadHttp test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -$fp = @fsockopen('pear.php.net', 80); -if (!$fp) { - echo 'skip'; -} else { - fclose($fp); -} -?> ---FILE-- -<?php -mkdir($temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testDownloadHttp'); -// 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/Common.php"; - -$common = &new PEAR_Common; - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); - -function catchit($err) -{ - echo "Caught error: " . $err->getMessage() . "\n"; -} - -echo "Test static:\n"; - -echo "Simple: "; -PEAR_Common::downloadHttp('http://test.pear.php.net/testdownload.tgz', $ui, $temp_path); -$firstone = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testdownload.tgz')); -$secondone = implode('', file($temp_path . DIRECTORY_SEPARATOR . 'testdownload.tgz')); -echo ($firstone == $secondone) ? "passed\n" : "failed\n"; - -echo "Simple fail:\n"; -PEAR_Common::downloadHttp('http://test.poop.php.net/stuff.tgz', $ui, $temp_path); - -echo "Test callback:\n"; - -$ui = 'My UI'; - -PEAR_Common::downloadHttp('http://test.pear.php.net/testdownload.tgz', $ui, $temp_path, 'myCallback'); -$firstone = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testdownload.tgz')); -$secondone = implode('', file($temp_path . DIRECTORY_SEPARATOR . 'testdownload.tgz')); -echo "Working Callback: "; -echo ($firstone == $secondone) ? "passed\n" : "failed\n"; - - -function myCallback($message, $payload) -{ - $stuff = serialize($payload); - echo "Callback Message: $message\n"; - echo "Callback Payload: $stuff\n"; -} - -echo "Callback fail:\n"; -PEAR_Common::downloadHttp('http://test.poop.php.net/stuff.tgz', $ui, $temp_path, 'myCallback'); - -cleanall($temp_path); - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -Test static: -Simple: passed -Simple fail: -Caught error: Connection to `test.poop.php.net:80' failed: The operation completed successfully. - -Test callback: -Callback Message: setup -Callback Payload: a:1:{i:0;s:5:"My UI";} -Callback Message: message -Callback Payload: s:35:"Using HTTP proxy test.pear.php.net:"; -Callback Message: saveas -Callback Payload: s:16:"testdownload.tgz"; -Callback Message: start -Callback Payload: a:2:{i:0;s:16:"testdownload.tgz";i:1;s:5:"41655";} -Callback Message: bytesread -Callback Payload: i:1024; -Callback Message: bytesread -Callback Payload: i:2048; -Callback Message: bytesread -Callback Payload: i:3072; -Callback Message: bytesread -Callback Payload: i:4096; -Callback Message: bytesread -Callback Payload: i:5120; -Callback Message: bytesread -Callback Payload: i:6144; -Callback Message: bytesread -Callback Payload: i:7168; -Callback Message: bytesread -Callback Payload: i:8192; -Callback Message: bytesread -Callback Payload: i:9216; -Callback Message: bytesread -Callback Payload: i:10240; -Callback Message: bytesread -Callback Payload: i:11264; -Callback Message: bytesread -Callback Payload: i:12288; -Callback Message: bytesread -Callback Payload: i:13312; -Callback Message: bytesread -Callback Payload: i:14336; -Callback Message: bytesread -Callback Payload: i:15360; -Callback Message: bytesread -Callback Payload: i:16384; -Callback Message: bytesread -Callback Payload: i:17408; -Callback Message: bytesread -Callback Payload: i:18432; -Callback Message: bytesread -Callback Payload: i:19456; -Callback Message: bytesread -Callback Payload: i:20480; -Callback Message: bytesread -Callback Payload: i:21504; -Callback Message: bytesread -Callback Payload: i:22528; -Callback Message: bytesread -Callback Payload: i:23552; -Callback Message: bytesread -Callback Payload: i:24576; -Callback Message: bytesread -Callback Payload: i:25600; -Callback Message: bytesread -Callback Payload: i:26624; -Callback Message: bytesread -Callback Payload: i:27648; -Callback Message: bytesread -Callback Payload: i:28672; -Callback Message: bytesread -Callback Payload: i:29696; -Callback Message: bytesread -Callback Payload: i:30720; -Callback Message: bytesread -Callback Payload: i:31744; -Callback Message: bytesread -Callback Payload: i:32768; -Callback Message: bytesread -Callback Payload: i:33792; -Callback Message: bytesread -Callback Payload: i:34816; -Callback Message: bytesread -Callback Payload: i:35840; -Callback Message: bytesread -Callback Payload: i:36864; -Callback Message: bytesread -Callback Payload: i:37888; -Callback Message: bytesread -Callback Payload: i:38912; -Callback Message: bytesread -Callback Payload: i:39936; -Callback Message: bytesread -Callback Payload: i:40960; -Callback Message: bytesread -Callback Payload: i:41655; -Callback Message: done -Callback Payload: i:41655; -Working Callback: passed -Callback fail: -Callback Message: setup -Callback Payload: a:1:{i:0;s:5:"My UI";} -Callback Message: message -Callback Payload: s:35:"Using HTTP proxy test.poop.php.net:"; -Callback Message: connfailed -Callback Payload: a:4:{i:0;s:17:"test.poop.php.net";i:1;i:80;i:2;i:0;i:3;s:39:"The operation completed successfully. -";} -Caught error: Connection to `test.poop.php.net:80' failed: The operation completed successfully.
\ No newline at end of file diff --git a/pear/tests/pear_common_infoFromString.phpt b/pear/tests/pear_common_infoFromString.phpt deleted file mode 100644 index f3d40464c6..0000000000 --- a/pear/tests/pear_common_infoFromString.phpt +++ /dev/null @@ -1,1752 +0,0 @@ ---TEST-- -PEAR_Common::infoFromString test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -if (!function_exists('token_get_all')) { - echo 'skip'; -} -?> ---FILE-- -<?php -putenv('PHP_PEAR_SYSCONF_DIR=' . dirname(__FILE__)); - -require_once "PEAR/Common.php"; - -$common = &new PEAR_Common; - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); - -function catchit($err) -{ - echo "Caught error: " . $err->getMessage() . "\n"; -} - -echo "Test invalid XML\n"; - -$common->infoFromString('\\goober'); - -echo "Test valid XML, not a package.xml\n"; - -$common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - "\n<grobbage></grobbage>"); - -echo "Test valid package.xml, invalid version number\n"; - -$common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="10000000"></package>'); - -echo "Test empty package.xml\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"></package>'); - -var_dump($ret); - -echo "Test 1\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name></package>'); - -var_dump($ret); - -echo "Test 2\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '</package>'); - -var_dump($ret); - -echo "Test 3\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description></package>'); - -var_dump($ret); - -echo "Test 4\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license></package>'); - -var_dump($ret); - -echo "Test 5\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers> -</package>'); - -var_dump($ret); - -echo "Test 6\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version></release> -</package>'); - -var_dump($ret); - -echo "Test 7\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version> - <date>2003-11-17</date> - <state>beta</state> - <notes>test</notes></release> -</package>'); - -var_dump($ret); - -echo "Test 8\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version> - <date>2003-11-17</date> - <state>beta</state> - <notes>test</notes> - <provides type="class" name="furngy" /></release> -</package>'); - -var_dump($ret); - -echo "Test 9\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version> - <date>2003-11-17</date> - <state>beta</state> - <notes>test</notes> - <provides type="class" name="furngy" /> - <deps> - <dep type="ext" rel="has" optional="yes">xmlrpc</dep> - </deps> -</release> -</package>'); - -var_dump($ret); - -echo "Test 10\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version> - <date>2003-11-17</date> - <state>beta</state> - <notes>test</notes> - <provides type="class" name="furngy" /> - <deps> - <dep type="ext" rel="has" optional="yes">xmlrpc</dep> - </deps> - <filelist> - <file role="data" name="package.dtd"/> - <file role="data" name="template.spec"/> - <file role="php" name="PEAR.php"/> - <file role="php" name="System.php"/> - <dir name="PEAR"> - <file role="php" name="Autoloader.php"/> - <file role="php" name="Command.php"/> - <dir name="Command"> - <file role="php" name="Auth.php"/> - <file role="php" name="Build.php"/> - <file role="php" name="Common.php"/> - <file role="php" name="Config.php"/> - <file role="php" name="Install.php"/> - <file role="php" name="Package.php"/> - <file role="php" name="Registry.php"/> - <file role="php" name="Remote.php"/> - <file role="php" name="Mirror.php"/> - </dir> - <file role="php" name="Common.php"/> - <file role="php" name="Config.php"/> - <file role="php" name="Dependency.php"/> - <dir name="Frontend"> - <file role="php" name="CLI.php"/> - </dir> - <file role="php" name="Builder.php"/> - <file role="php" name="Installer.php"/> - <file role="php" name="Packager.php"/> - <file role="php" name="Registry.php"/> - <file role="php" name="Remote.php"/> - </dir> - <dir name="OS"> - <file role="php" name="Guess.php"/> - </dir> - <dir name="scripts" baseinstalldir="/"> - <file role="script" install-as="pear" name="pear.sh"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" platform="windows" install-as="pear.bat" name="pear.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="php" install-as="pearcmd.php" name="pearcmd.php"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - </dir> - </filelist> - -</release> -</package>'); - -var_dump($ret); - -echo "Test 11\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version> - <date>2003-11-17</date> - <state>beta</state> - <notes>test</notes> - <provides type="class" name="furngy" /> - <deps> - <dep type="ext" rel="has" optional="yes">xmlrpc</dep> - </deps> - <filelist> - <file role="data" name="package.dtd"/> - <file role="data" name="template.spec"/> - <file role="php" name="PEAR.php"/> - <file role="php" name="System.php"/> - <dir name="PEAR"> - <file role="php" name="Autoloader.php"/> - <file role="php" name="Command.php"/> - <dir name="Command"> - <file role="php" name="Auth.php"/> - <file role="php" name="Build.php"/> - <file role="php" name="Common.php"/> - <file role="php" name="Config.php"/> - <file role="php" name="Install.php"/> - <file role="php" name="Package.php"/> - <file role="php" name="Registry.php"/> - <file role="php" name="Remote.php"/> - <file role="php" name="Mirror.php"/> - </dir> - <file role="php" name="Common.php"/> - <file role="php" name="Config.php"/> - <file role="php" name="Dependency.php"/> - <dir name="Frontend"> - <file role="php" name="CLI.php"/> - </dir> - <file role="php" name="Builder.php"/> - <file role="php" name="Installer.php"/> - <file role="php" name="Packager.php"/> - <file role="php" name="Registry.php"/> - <file role="php" name="Remote.php"/> - </dir> - <dir name="OS"> - <file role="php" name="Guess.php"/> - </dir> - <dir name="scripts" baseinstalldir="/"> - <file role="script" install-as="pear" name="pear.sh"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" platform="windows" install-as="pear.bat" name="pear.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="php" install-as="pearcmd.php" name="pearcmd.php"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - </dir> - </filelist> - <configureoptions> - <configureoption name="test" prompt="The prompt test" default="foo" /> - </configureoptions> -</release> -</package>'); - -var_dump($ret); - -echo "Test 12\n"; - -$ret = $common->infoFromString('<?xml version="1.0" encoding="ISO-8859-1" ?>' . - '<package version="1.0"><name>test</name><summary>PEAR test</summary>' . - '<description>The test</description><license>PHP License</license> <maintainers> - <maintainer> - <user>test</user> - <role>lead</role> - <name>test tester</name> - <email>test@php.net</email> - </maintainer></maintainers><release> - <version>1.3b4</version> - <date>2003-11-17</date> - <state>beta</state> - <notes>test</notes> - <provides type="class" name="furngy" /> - <deps> - <dep type="ext" rel="has" optional="yes">xmlrpc</dep> - </deps> - <filelist> - <file role="data" name="package.dtd"/> - <file role="data" name="template.spec"/> - <file role="php" name="PEAR.php"/> - <file role="php" name="System.php"/> - <dir name="PEAR"> - <file role="php" name="Autoloader.php"/> - <file role="php" name="Command.php"/> - <dir name="Command"> - <file role="php" name="Auth.php"/> - <file role="php" name="Build.php"/> - <file role="php" name="Common.php"/> - <file role="php" name="Config.php"/> - <file role="php" name="Install.php"/> - <file role="php" name="Package.php"/> - <file role="php" name="Registry.php"/> - <file role="php" name="Remote.php"/> - <file role="php" name="Mirror.php"/> - </dir> - <file role="php" name="Common.php"/> - <file role="php" name="Config.php"/> - <file role="php" name="Dependency.php"/> - <dir name="Frontend"> - <file role="php" name="CLI.php"/> - </dir> - <file role="php" name="Builder.php"/> - <file role="php" name="Installer.php"/> - <file role="php" name="Packager.php"/> - <file role="php" name="Registry.php"/> - <file role="php" name="Remote.php"/> - </dir> - <dir name="OS"> - <file role="php" name="Guess.php"/> - </dir> - <dir name="scripts" baseinstalldir="/"> - <file role="script" install-as="pear" name="pear.sh"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" platform="windows" install-as="pear.bat" name="pear.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="php" install-as="pearcmd.php" name="pearcmd.php"> - <replace from="@php_bin@" to="php_bin" type="pear-config"/> - <replace from="@php_dir@" to="php_dir" type="pear-config"/> - <replace from="@pear_version@" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - </dir> - </filelist> - <configureoptions> - <configureoption name="test" prompt="The prompt test" default="foo" /> - </configureoptions> -</release> - <changelog> - <release> - <version>0.1</version> - <date>2003-07-21</date> - <license>PHP License</license> - <state>alpha</state> - <notes>First release of test</notes> - </release> - <release> - <version>0.2</version> - <date>2003-07-21</date> - <license>PHP License</license> - <state>alpha</state> - <notes>Generation of package.xml from scratch is now supported. In addition, -generation of <provides> is supported and so is addition of -maintainers and configure options - -- Fixed a bug in <release> generation -- Added _addProvides() to generate a <provides> section</notes> - </release> - </changelog> -</package>'); - -var_dump($ret); - -?> ---EXPECT-- -Test invalid XML -Caught error: XML error: not well-formed (invalid token) at line 1 -Test valid XML, not a package.xml -Caught error: Invalid Package File, no <package> tag -Test valid package.xml, invalid version number -Caught error: No handlers for package.xml version 10000000 -Test empty package.xml -array(2) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } -} -Test 1 -array(3) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" -} -Test 2 -array(4) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" -} -Test 3 -array(5) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" -} -Test 4 -array(6) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" -} -Test 5 -array(7) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } -} -Test 6 -array(8) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" -} -Test 7 -array(11) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" - ["release_date"]=> - string(10) "2003-11-17" - ["release_state"]=> - string(4) "beta" - ["release_notes"]=> - string(4) "test" -} -Test 8 -array(11) { - ["provides"]=> - array(1) { - ["class;furngy"]=> - array(3) { - ["type"]=> - string(5) "class" - ["name"]=> - string(6) "furngy" - ["explicit"]=> - bool(true) - } - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" - ["release_date"]=> - string(10) "2003-11-17" - ["release_state"]=> - string(4) "beta" - ["release_notes"]=> - string(4) "test" -} -Test 9 -array(12) { - ["provides"]=> - array(1) { - ["class;furngy"]=> - array(3) { - ["type"]=> - string(5) "class" - ["name"]=> - string(6) "furngy" - ["explicit"]=> - bool(true) - } - } - ["filelist"]=> - &array(0) { - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" - ["release_date"]=> - string(10) "2003-11-17" - ["release_state"]=> - string(4) "beta" - ["release_notes"]=> - string(4) "test" - ["release_deps"]=> - array(1) { - [1]=> - array(4) { - ["type"]=> - string(3) "ext" - ["rel"]=> - string(3) "has" - ["optional"]=> - string(3) "yes" - ["name"]=> - string(6) "xmlrpc" - } - } -} -Test 10 -array(12) { - ["provides"]=> - array(1) { - ["class;furngy"]=> - array(3) { - ["type"]=> - string(5) "class" - ["name"]=> - string(6) "furngy" - ["explicit"]=> - bool(true) - } - } - ["filelist"]=> - &array(28) { - ["package.dtd"]=> - array(1) { - ["role"]=> - string(4) "data" - } - ["template.spec"]=> - array(1) { - ["role"]=> - string(4) "data" - } - ["PEAR.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["System.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Autoloader.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Auth.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Build.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Common.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Config.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Install.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Package.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Registry.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Remote.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Mirror.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Common.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Config.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Dependency.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Frontend\CLI.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Builder.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Installer.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Packager.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Registry.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Remote.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["OS\Guess.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["scripts\pear.sh"]=> - array(4) { - ["role"]=> - string(6) "script" - ["install-as"]=> - string(4) "pear" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(4) { - [0]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_dir@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@pear_version@" - ["to"]=> - string(7) "version" - ["type"]=> - string(12) "package-info" - } - [3]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - ["scripts\pear.bat"]=> - array(5) { - ["role"]=> - string(6) "script" - ["platform"]=> - string(7) "windows" - ["install-as"]=> - string(8) "pear.bat" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(3) { - [0]=> - array(3) { - ["from"]=> - string(9) "@bin_dir@" - ["to"]=> - string(7) "bin_dir" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - ["scripts\pearcmd.php"]=> - array(4) { - ["role"]=> - string(3) "php" - ["install-as"]=> - string(11) "pearcmd.php" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(4) { - [0]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_dir@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@pear_version@" - ["to"]=> - string(7) "version" - ["type"]=> - string(12) "package-info" - } - [3]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" - ["release_date"]=> - string(10) "2003-11-17" - ["release_state"]=> - string(4) "beta" - ["release_notes"]=> - string(4) "test" - ["release_deps"]=> - array(1) { - [1]=> - array(4) { - ["type"]=> - string(3) "ext" - ["rel"]=> - string(3) "has" - ["optional"]=> - string(3) "yes" - ["name"]=> - string(6) "xmlrpc" - } - } -} -Test 11 -array(13) { - ["provides"]=> - array(1) { - ["class;furngy"]=> - array(3) { - ["type"]=> - string(5) "class" - ["name"]=> - string(6) "furngy" - ["explicit"]=> - bool(true) - } - } - ["filelist"]=> - &array(28) { - ["package.dtd"]=> - array(1) { - ["role"]=> - string(4) "data" - } - ["template.spec"]=> - array(1) { - ["role"]=> - string(4) "data" - } - ["PEAR.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["System.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Autoloader.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Auth.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Build.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Common.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Config.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Install.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Package.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Registry.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Remote.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Mirror.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Common.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Config.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Dependency.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Frontend\CLI.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Builder.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Installer.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Packager.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Registry.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Remote.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["OS\Guess.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["scripts\pear.sh"]=> - array(4) { - ["role"]=> - string(6) "script" - ["install-as"]=> - string(4) "pear" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(4) { - [0]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_dir@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@pear_version@" - ["to"]=> - string(7) "version" - ["type"]=> - string(12) "package-info" - } - [3]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - ["scripts\pear.bat"]=> - array(5) { - ["role"]=> - string(6) "script" - ["platform"]=> - string(7) "windows" - ["install-as"]=> - string(8) "pear.bat" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(3) { - [0]=> - array(3) { - ["from"]=> - string(9) "@bin_dir@" - ["to"]=> - string(7) "bin_dir" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - ["scripts\pearcmd.php"]=> - array(4) { - ["role"]=> - string(3) "php" - ["install-as"]=> - string(11) "pearcmd.php" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(4) { - [0]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_dir@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@pear_version@" - ["to"]=> - string(7) "version" - ["type"]=> - string(12) "package-info" - } - [3]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" - ["release_date"]=> - string(10) "2003-11-17" - ["release_state"]=> - string(4) "beta" - ["release_notes"]=> - string(4) "test" - ["release_deps"]=> - array(1) { - [1]=> - array(4) { - ["type"]=> - string(3) "ext" - ["rel"]=> - string(3) "has" - ["optional"]=> - string(3) "yes" - ["name"]=> - string(6) "xmlrpc" - } - } - ["configure_options"]=> - array(1) { - [0]=> - array(3) { - ["name"]=> - string(4) "test" - ["prompt"]=> - string(15) "The prompt test" - ["default"]=> - string(3) "foo" - } - } -} -Test 12 -array(14) { - ["provides"]=> - array(1) { - ["class;furngy"]=> - array(3) { - ["type"]=> - string(5) "class" - ["name"]=> - string(6) "furngy" - ["explicit"]=> - bool(true) - } - } - ["filelist"]=> - &array(28) { - ["package.dtd"]=> - array(1) { - ["role"]=> - string(4) "data" - } - ["template.spec"]=> - array(1) { - ["role"]=> - string(4) "data" - } - ["PEAR.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["System.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Autoloader.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Auth.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Build.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Common.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Config.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Install.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Package.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Registry.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Remote.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Command\Mirror.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Common.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Config.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Dependency.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Frontend\CLI.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Builder.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Installer.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Packager.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Registry.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["PEAR\Remote.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["OS\Guess.php"]=> - array(1) { - ["role"]=> - string(3) "php" - } - ["scripts\pear.sh"]=> - array(4) { - ["role"]=> - string(6) "script" - ["install-as"]=> - string(4) "pear" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(4) { - [0]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_dir@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@pear_version@" - ["to"]=> - string(7) "version" - ["type"]=> - string(12) "package-info" - } - [3]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - ["scripts\pear.bat"]=> - array(5) { - ["role"]=> - string(6) "script" - ["platform"]=> - string(7) "windows" - ["install-as"]=> - string(8) "pear.bat" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(3) { - [0]=> - array(3) { - ["from"]=> - string(9) "@bin_dir@" - ["to"]=> - string(7) "bin_dir" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - ["scripts\pearcmd.php"]=> - array(4) { - ["role"]=> - string(3) "php" - ["install-as"]=> - string(11) "pearcmd.php" - ["baseinstalldir"]=> - string(1) "/" - ["replacements"]=> - array(4) { - [0]=> - array(3) { - ["from"]=> - string(9) "@php_bin@" - ["to"]=> - string(7) "php_bin" - ["type"]=> - string(11) "pear-config" - } - [1]=> - array(3) { - ["from"]=> - string(9) "@php_dir@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - [2]=> - array(3) { - ["from"]=> - string(14) "@pear_version@" - ["to"]=> - string(7) "version" - ["type"]=> - string(12) "package-info" - } - [3]=> - array(3) { - ["from"]=> - string(14) "@include_path@" - ["to"]=> - string(7) "php_dir" - ["type"]=> - string(11) "pear-config" - } - } - } - } - ["package"]=> - string(4) "test" - ["summary"]=> - string(9) "PEAR test" - ["description"]=> - string(8) "The test" - ["release_license"]=> - string(11) "PHP License" - ["maintainers"]=> - array(1) { - [0]=> - &array(4) { - ["handle"]=> - string(4) "test" - ["role"]=> - string(4) "lead" - ["name"]=> - string(11) "test tester" - ["email"]=> - string(12) "test@php.net" - } - } - ["version"]=> - string(5) "1.3b4" - ["release_date"]=> - string(10) "2003-11-17" - ["release_state"]=> - string(4) "beta" - ["release_notes"]=> - string(4) "test" - ["release_deps"]=> - array(1) { - [1]=> - array(4) { - ["type"]=> - string(3) "ext" - ["rel"]=> - string(3) "has" - ["optional"]=> - string(3) "yes" - ["name"]=> - string(6) "xmlrpc" - } - } - ["configure_options"]=> - array(1) { - [0]=> - array(3) { - ["name"]=> - string(4) "test" - ["prompt"]=> - string(15) "The prompt test" - ["default"]=> - string(3) "foo" - } - } - ["changelog"]=> - array(2) { - [0]=> - &array(5) { - ["version"]=> - string(3) "0.1" - ["release_date"]=> - string(10) "2003-07-21" - ["release_license"]=> - string(11) "PHP License" - ["release_state"]=> - string(5) "alpha" - ["release_notes"]=> - string(22) "First release of test -" - } - [1]=> - &array(5) { - ["version"]=> - string(3) "0.2" - ["release_date"]=> - string(10) "2003-07-21" - ["release_license"]=> - string(11) "PHP License" - ["release_state"]=> - string(5) "alpha" - ["release_notes"]=> - string(260) "Generation of package.xml from scratch is now supported. In addition, -generation of <provides> is supported and so is addition of -maintainers and configure options - -- Fixed a bug in <release> generation -- Added _addProvides() to generate a <provides> section -" - } - } -}
\ No newline at end of file diff --git a/pear/tests/pear_common_sortPkgDeps.phpt b/pear/tests/pear_common_sortPkgDeps.phpt deleted file mode 100644 index 5097888ee4..0000000000 --- a/pear/tests/pear_common_sortPkgDeps.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -PEAR_Common::sortPkgDeps test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php -$dir = getcwd(); -chdir(dirname(__FILE__)); - -require_once 'PEAR/Common.php'; - -$c = new PEAR_Common(); - -$packages = array( -'common_sortPkgDeps6_package.xml', -'common_sortPkgDeps2_package.xml', -'common_sortPkgDeps1_package.xml', -'common_sortPkgDeps4_package.xml', -'common_sortPkgDeps5_package.xml', -'common_sortPkgDeps3_package.xml', -); - -$uninstallpackages = array( -$c->infoFromAny('common_sortPkgDeps6_package.xml'), -$c->infoFromAny('common_sortPkgDeps2_package.xml'), -$c->infoFromAny('common_sortPkgDeps1_package.xml'), -$c->infoFromAny('common_sortPkgDeps4_package.xml'), -$c->infoFromAny('common_sortPkgDeps5_package.xml'), -$c->infoFromAny('common_sortPkgDeps3_package.xml'), -); - -echo "Test Install Sort:\n"; -$c->sortPkgDeps($packages); -dumpPacks($packages); - -echo "Test Uninstall Sort:\n"; -$c->sortPkgDeps($uninstallpackages, true); -dumpPacks($uninstallpackages); - -chdir($dir); - -function dumpPacks($p) -{ - echo "Packages(\n"; - foreach ($p as $inf) { - echo $inf['info']['package'] . ",\n"; - } - echo ")\n"; -} -?> ---EXPECT-- -Test Install Sort: -Packages( -pkg6, -pkg5, -pkg4, -pkg3, -pkg2, -pkg1, -) -Test Uninstall Sort: -Packages( -pkg1, -pkg2, -pkg3, -pkg5, -pkg4, -pkg6, -)
\ No newline at end of file diff --git a/pear/tests/pear_common_validPackageVersion.phpt b/pear/tests/pear_common_validPackageVersion.phpt deleted file mode 100644 index c177bb202a..0000000000 --- a/pear/tests/pear_common_validPackageVersion.phpt +++ /dev/null @@ -1,81 +0,0 @@ ---TEST-- -PEAR_Common::validPackageVersion test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -require_once 'PEAR/Common.php'; - -// '\d+(?:\.\d+)*(?:[a-z]+\d*)?' - -echo "==Valid Tests==\n"; -$a = '1'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.1'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.1.1'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.1.1.1'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.1.1abc3'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.234beta4'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1alpha3'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1alpha'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.1a'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -echo "==Invalid Tests==\n"; - -$a = '1.0.0-alpha2'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1alpha.4'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; - -$a = '1.1alpha.4'; -echo "$a "; -echo (PEAR_Common::validPackageVersion($a)) ? "valid\n" : "invalid\n"; -?> ---EXPECT-- -==Valid Tests== -1 valid -1.1 valid -1.1.1 valid -1.1.1.1 valid -1.1.1abc3 valid -1.234beta4 valid -1alpha3 valid -1alpha valid -1.1a valid -==Invalid Tests== -1.0.0-alpha2 invalid -1alpha.4 invalid -1.1alpha.4 invalid diff --git a/pear/tests/pear_config.phpt b/pear/tests/pear_config.phpt deleted file mode 100644 index 395986b9bd..0000000000 --- a/pear/tests/pear_config.phpt +++ /dev/null @@ -1,304 +0,0 @@ ---TEST-- -PEAR_Config ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; - exit(); -} -include 'PEAR/Config.php'; -$pv = phpversion() . ''; -$av = $pv{0} == '4' ? 'apiversion' : 'apiVersion'; -if (in_array($av, get_class_methods('PEAR_Config'))) { - echo '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_bin php_dir preferred_state sig_bin sig_keydir sig_keyid 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_bin: File Locations (Advanced) -php_dir: File Locations -preferred_state: Advanced -sig_bin: Maintainers -sig_keydir: Maintainers -sig_keyid: 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, php_bin, test_dir -Internet Access: http_proxy, master_server -Maintainers: password, sig_bin, sig_keydir, sig_keyid, 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_bin: PHP CLI/CGI binary -php_dir: PEAR directory -preferred_state: Preferred Package State -sig_bin: Signature Handling Program -sig_keydir: Signature Key Directory -sig_keyid: Signature Key Id -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_config_1.1.phpt b/pear/tests/pear_config_1.1.phpt deleted file mode 100644 index 0ffb1b5e69..0000000000 --- a/pear/tests/pear_config_1.1.phpt +++ /dev/null @@ -1,394 +0,0 @@ ---TEST-- -PEAR_Config v1.1 ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; - exit(); -} -include_once 'PEAR/Config.php'; -$pv = phpversion() . ''; -$av = $pv{0} == '4' ? 'apiversion' : 'apiVersion'; -if (!in_array($av, get_class_methods('PEAR_Config'))) { - echo 'skip'; -} -if (PEAR_Config::apiVersion() != '1.1') { - echo 'skip'; -} -?> ---FILE-- -<?php - -error_reporting(E_ALL); -chdir(dirname(__FILE__)); -include_once "PEAR/Config.php"; -copy("system.input", "system.conf"); -copy("user.input", "user.conf"); -copy("user2.input", "user2.conf"); -copy("merge.input", "merge.conf"); -copy("user3.input", "user3.conf"); -copy("merge2.input", "merge2.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"); -$config->readConfigFile("user3.conf"); -dump_config($config, "user"); -$config->mergeConfigFile("merge2.conf", true); -dump_config($config, "user"); -$config->readConfigFile("user3.conf"); -$config->mergeConfigFile("merge2.conf", false); -dump_config($config, "user"); - -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#6.5 testing: get/set/remove w/channels\n"; -$config->readConfigFile('user3.conf'); -$config->setChannels(array('pear', 'test1', 'test2')); -var_dump($config->get('default_channel')); - -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"; -$config->readConfigFile('user.conf'); -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#10.5 testing: definedBy with channel\n"; -$config->readConfigFile('user3.conf'); -var_dump($config->definedBy('verbose')); -$config->set('default_channel', 'test1'); -var_dump($config->definedBy('verbose')); -var_dump($config->definedBy('php_dir')); -var_dump($config->definedBy('gronk')); -$config->set('default_channel', 'pear'); -var_dump($config->definedBy('verbose', true)); -$config->set('default_channel', 'test1'); -var_dump($config->definedBy('verbose', true)); -var_dump($config->definedBy('php_dir', true)); -var_dump($config->definedBy('gronk', true)); - -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("user3.conf"); -unlink("system.conf"); -unlink("merge.conf"); -unlink("merge2.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) { - if (is_array($v)) { - print "\n "; - dump_array("${name}[$k]", $v); - continue; - } - 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' -user: verbose="60" - user[__channels]: - user[__channels][test1]: verbose="70" - - user[__channels][test2]: verbose="71" - - -user: - user[__channels]: - user[__channels][test1]: verbose="898" - - user[__channels][test2]: verbose="899" - - verbose="35" -user: - user[__channels]: - user[__channels][test1]: verbose="70" - - user[__channels][test2]: verbose="71" - - verbose="60" - -#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) - -#6.5 testing: get/set/remove w/channels -string(4) "pear" - -#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 default_channel doc_dir ext_dir http_proxy master_server password php_bin php_dir preferred_state sig_bin sig_keydir sig_keyid 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" - -#10.5 testing: definedBy with channel -string(4) "user" -string(4) "user" -string(7) "default" -string(0) "" -array(2) { - ["layer"]=> - string(4) "user" - ["channel"]=> - string(4) "pear" -} -array(2) { - ["layer"]=> - string(4) "user" - ["channel"]=> - string(5) "test1" -} -array(2) { - ["layer"]=> - string(7) "default" - ["channel"]=> - string(4) "pear" -} -string(0) "" - -#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) -default_channel: Internet Access -doc_dir: File Locations -ext_dir: File Locations -http_proxy: Internet Access -master_server: Internet Access -password: Maintainers -php_bin: File Locations (Advanced) -php_dir: File Locations -preferred_state: Advanced -sig_bin: Maintainers -sig_keydir: Maintainers -sig_keyid: 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, php_bin, test_dir -Internet Access: default_channel, http_proxy, master_server -Maintainers: password, sig_bin, sig_keydir, sig_keyid, 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 -default_channel: Default Channel -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_bin: PHP CLI/CGI binary -php_dir: PEAR directory -preferred_state: Preferred Package State -sig_bin: Signature Handling Program -sig_keydir: Signature Key Directory -sig_keyid: Signature Key Id -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_dependency_checkExtension.phpt b/pear/tests/pear_dependency_checkExtension.phpt deleted file mode 100644 index 4992f17864..0000000000 --- a/pear/tests/pear_dependency_checkExtension.phpt +++ /dev/null @@ -1,265 +0,0 @@ ---TEST-- -PEAR_Dependency::checkExtension() test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; - exit; -} -if (!ini_get('enable_dl') || ini_get('safe_mode')) { - echo 'skip'; - exit; -} - -require_once 'System.php'; - -$dir = ini_get('extension_dir'); -if (OS_WINDOWS) { - $suffix = '.dll'; -} elseif (PHP_OS == 'HP-UX') { - $suffix = '.sl'; -} elseif (PHP_OS == 'AIX') { - $suffix = '.a'; -} elseif (PHP_OS == 'OSX') { - $suffix = '.bundle'; -} else { - $suffix = '.so'; -} - -// get a list of possible extensions -$extensions = array(); -if ($handle = opendir($dir)) { - while (false !== ($file = readdir($handle))) { - if (strpos($file, $suffix) && substr($file, 0, 4) == 'php_') { - $extensions[] = $file; - } - } - closedir($handle); -} - -$loaded = false; -$notloaded = false; -// choose an extension for this test -foreach ($extensions as $ext) { - $ext = substr(substr($ext, 0, strlen($ext) - strlen($suffix)), 4); - if (!$loaded && extension_loaded($ext)) { - $loaded = $ext; - } - if (!$notloaded && !extension_loaded($ext)) { - // safe list for testing - if (in_array($ext, array('zip', 'bz2', 'sqlite', 'dbx'))) { - $notloaded = $ext; - } - } -} -if (!$notloaded || !$loaded) { - echo 'skip'; - exit; -} -?> ---FILE-- -<?php - -@mkdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); -require_once "PEAR/Registry.php"; -require_once "PEAR/Dependency.php"; - -$dir = ini_get('extension_dir'); -if (OS_WINDOWS) { - $suffix = '.dll'; -} elseif (PHP_OS == 'HP-UX') { - $suffix = '.sl'; -} elseif (PHP_OS == 'AIX') { - $suffix = '.a'; -} elseif (PHP_OS == 'OSX') { - $suffix = '.bundle'; -} else { - $suffix = '.so'; -} - -// get a list of possible extensions -$extensions = array(); -if ($handle = opendir($dir)) { - while (false !== ($file = readdir($handle))) { - if (strpos($file, $suffix) && substr($file, 0, 4) == 'php_') { - $extensions[] = $file; - } - } - closedir($handle); -} - -$loaded = false; -$notloaded = false; -// choose an extension for this test -foreach ($extensions as $ext) { - $ext = substr(substr($ext, 0, strlen($ext) - strlen($suffix)), 4); - if (!$loaded && extension_loaded($ext)) { - $loaded = $ext; - } - if (!$notloaded && !extension_loaded($ext)) { - // safe list for testing - if (in_array($ext, array('zip', 'bz2', 'sqlite', 'dbx'))) { - $notloaded = $ext; - } - } -} - -$reg = new PEAR_Registry; -$reg->statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'; -$dep = new PEAR_Dependency($reg); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, null, 'has'); -echo 'extension 1 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $notloaded, null, 'not'); -echo 'extension 2 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$loadedver = phpversion($loaded); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver + 1, 'ge'); -echo 'extension 3 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version >= " . ($loadedver + 1) . - " is required" ? "match\n" : "$msg\n" ); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver + 1, 'ge', true); -echo 'extension 3 optional ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version >= " . ($loadedver + 1) . - " is recommended to utilize some features" ? "match\n" : "$msg\n" ); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver, 'ne'); -echo 'extension 4 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version != " . $loadedver . - " is required" ? "match\n" : "$msg\n" ); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver, 'gt'); -echo 'extension 5 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version > " . $loadedver . - " is required" ? "match\n" : "$msg\n" ); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver, 'gt', true); -echo 'extension 5 optional ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version > " . $loadedver . - " is recommended to utilize some features" ? "match\n" : "$msg\n" ); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver, 'lt'); -echo 'extension 6 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version < " . $loadedver . - " is required" ? "match\n" : "$msg\n" ); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver, 'lt', true); -echo 'extension 6 optional ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version < " . $loadedver . - " is recommended to utilize some features" ? "match\n" : "$msg\n" ); - -if ($loadedver == 0) { - echo "extension 7 ok? no\nmessage : match\n"; - echo "extension 7 optional ok? no\nmessage : match\n"; -} else { - $msg = 'no error'; - $ret = $dep->checkExtension($msg, $loaded, $loadedver - 1, 'le'); - echo 'extension 7 ok? '; - echo $ret ? "no\n" : "yes\n"; - echo 'message : ' . ($msg == "'$loaded' PHP extension version <= " . ($loadedver - 1). - " is required" ? "match\n" : "$msg\n"); - - $msg = 'no error'; - $ret = $dep->checkExtension($msg, $loaded, $loadedver - 1, 'le', true); - echo 'extension 7 ok? '; - echo $ret ? "no\n" : "yes\n"; - echo 'message : ' . ($msg == "'$loaded' PHP extension version <= " . ($loadedver - 1). - " is recommended to utilize some features" ? "match\n" : "$msg\n"); -} - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver, 'eq'); -echo 'extension 8 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $notloaded, $loadedver, 'ne'); -echo 'extension 9 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver + 1, 'eq'); -echo 'extension 10 ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version == " . ($loadedver + 1). - " is required" ? "match\n" : "$msg\n"); - -$msg = 'no error'; -$ret = $dep->checkExtension($msg, $loaded, $loadedver + 1, 'eq', true); -echo 'extension 10 optional ok? '; -echo $ret ? "no\n" : "yes\n"; -echo 'message : ' . ($msg == "'$loaded' PHP extension version == " . ($loadedver + 1). - " is recommended to utilize some features" ? "match\n" : "$msg\n"); - -cleanall(); -// ------------------------------------------------------------------------- // - -function cleanall() -{ - $dp = opendir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); - while ($ent = readdir($dp)) { - if (substr($ent, -4) == ".reg") { - unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp' . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); -} - -?> ---EXPECT-- -extension 1 ok? yes -no error -extension 2 ok? yes -no error -extension 3 ok? no -message : match -extension 3 optional ok? no -message : match -extension 4 ok? no -message : match -extension 5 ok? no -message : match -extension 5 optional ok? no -message : match -extension 6 ok? no -message : match -extension 6 optional ok? no -message : match -extension 7 ok? no -message : match -extension 7 optional ok? no -message : match -extension 8 ok? yes -no error -extension 9 ok? yes -no error -extension 10 ok? no -message : match -extension 10 optional ok? no -message : match diff --git a/pear/tests/pear_dependency_checkPackage.phpt b/pear/tests/pear_dependency_checkPackage.phpt deleted file mode 100644 index 90dfb556f6..0000000000 --- a/pear/tests/pear_dependency_checkPackage.phpt +++ /dev/null @@ -1,267 +0,0 @@ ---TEST-- -PEAR_Dependency::checkPackage() test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php -require_once "PEAR/Registry.php"; -require_once "PEAR/Dependency.php"; - -mkdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); -// snarfed from pear_registry.phpt -$reg = new PEAR_Registry; -$reg->statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'; - -$files1 = array( - "pkg1-1.php" => array( - "role" => "php", - ), - "pkg1-2.php" => array( - "role" => "php", - "baseinstalldir" => "pkg1", - ), - ); -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1)); - -$dep = new PEAR_Dependency($reg); -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1'); -echo 'has works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'eq'); -echo 'eq 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'le'); -echo 'le 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.1', 'lt'); -echo 'lt 1.1 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.1', 'ne'); -echo 'ne 1.1 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'ge'); -echo 'ge 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '0.9', 'gt'); -echo 'ge 0.9 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg2', null, 'not'); -echo 'not pkg2 works? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; - -// error conditions - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg2', null, 'has'); -echo 'has pkg2 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_MISSING? '; -echo ($ret == PEAR_DEPENDENCY_MISSING) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg2', null, 'has', true); -echo 'has optional pkg2 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_MISSING_OPTIONAL? '; -echo ($ret == PEAR_DEPENDENCY_MISSING_OPTIONAL) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '0.9', 'le'); -echo 'le 0.9 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_CONFLICT? '; -echo ($ret == PEAR_DEPENDENCY_CONFLICT) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '0.9', 'le', true); -echo 'optional le 0.9 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? '; -echo ($ret == PEAR_DEPENDENCY_CONFLICT_OPTIONAL) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'ne'); -echo 'ne 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_CONFLICT? '; -echo ($ret == PEAR_DEPENDENCY_CONFLICT) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'ne', true); -echo 'optional ne 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? '; -echo ($ret == PEAR_DEPENDENCY_CONFLICT_OPTIONAL) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.1', 'ge'); -echo 'ge 1.1 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_UPGRADE_MINOR? '; -echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.1', 'ge', true); -echo 'optional ge 1.1 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? '; -echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '2.0', 'ge'); -echo 'ge 2.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_UPGRADE_MAJOR? '; -echo ($ret == PEAR_DEPENDENCY_UPGRADE_MAJOR) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '2.0', 'ge', true); -echo 'optional ge 2.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL? '; -echo ($ret == PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'gt'); -echo 'gt 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_UPGRADE_MINOR? '; -echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'gt', true); -echo 'optional gt 1.0 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? '; -echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', null, 'not'); -echo 'not pkg1 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_CONFLICT? '; -echo ($ret == PEAR_DEPENDENCY_CONFLICT) ? "yes\n" : "no\n"; -echo $msg . "\n"; - -$msg = 'no error'; -$ret = $dep->checkPackage($msg, 'pkg1', null, 'foobar'); -echo 'foobar pkg1 works? '; -echo $ret ? "no\n" : "yes\n"; -echo '$ret is PEAR_DEPENDENCY_BAD_DEPENDENCY? '; -echo ($ret == PEAR_DEPENDENCY_BAD_DEPENDENCY) ? "yes\n" : "no\n"; -echo $msg . "\n"; -cleanall(); - -// ------------------------------------------------------------------------- // - -function cleanall() -{ - $dp = opendir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); - while ($ent = readdir($dp)) { - if (substr($ent, -4) == ".reg") { - unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp' . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); -} - -?> ---EXPECT-- -has works? yes -no error -eq 1.0 works? yes -no error -le 1.0 works? yes -no error -lt 1.1 works? yes -no error -ne 1.1 works? yes -no error -ge 1.0 works? yes -no error -ge 0.9 works? yes -no error -not pkg2 works? yes -no error -has pkg2 works? no -$ret is PEAR_DEPENDENCY_MISSING? yes -requires package `pear::pkg2' -has optional pkg2 works? no -$ret is PEAR_DEPENDENCY_MISSING_OPTIONAL? yes -package `pear::pkg2' is recommended to utilize some features. -le 0.9 works? no -$ret is PEAR_DEPENDENCY_CONFLICT? yes -requires package `pear::pkg1' <= 0.9 -optional le 0.9 works? no -$ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? yes -package `pear::pkg1' version <= 0.9 is recommended to utilize some features. Installed version is 1.0 -ne 1.0 works? no -$ret is PEAR_DEPENDENCY_CONFLICT? yes -requires package `pear::pkg1' != 1.0 -optional ne 1.0 works? no -$ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? yes -package `pear::pkg1' version != 1.0 is recommended to utilize some features. Installed version is 1.0 -ge 1.1 works? no -$ret is PEAR_DEPENDENCY_UPGRADE_MINOR? yes -requires package `pear::pkg1' >= 1.1 -optional ge 1.1 works? no -$ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? yes -package `pear::pkg1' version >= 1.1 is recommended to utilize some features. Installed version is 1.0 -ge 2.0 works? no -$ret is PEAR_DEPENDENCY_UPGRADE_MAJOR? yes -requires package `pear::pkg1' >= 2.0 -optional ge 2.0 works? no -$ret is PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL? yes -package `pear::pkg1' version >= 2.0 is recommended to utilize some features. Installed version is 1.0 -gt 1.0 works? no -$ret is PEAR_DEPENDENCY_UPGRADE_MINOR? yes -requires package `pear::pkg1' > 1.0 -optional gt 1.0 works? no -$ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? yes -package `pear::pkg1' version > 1.0 is recommended to utilize some features. Installed version is 1.0 -not pkg1 works? no -$ret is PEAR_DEPENDENCY_CONFLICT? yes -conflicts with package `pear::pkg1' -foobar pkg1 works? no -$ret is PEAR_DEPENDENCY_BAD_DEPENDENCY? yes -relation 'foobar' with requirement '' is not supported (name=pear::pkg1) diff --git a/pear/tests/pear_dependency_checkPackageUninstall.phpt b/pear/tests/pear_dependency_checkPackageUninstall.phpt deleted file mode 100644 index b93a2ea1db..0000000000 --- a/pear/tests/pear_dependency_checkPackageUninstall.phpt +++ /dev/null @@ -1,176 +0,0 @@ ---TEST-- -PEAR_Dependency::checkPackageUninstall() test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -require_once "PEAR/Registry.php"; -require_once "PEAR/Dependency.php"; - -// snarfed from pear_registry.phpt -$reg = new PEAR_Registry; -@mkdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); -$reg->statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'; - -$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", - ), - ); - -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2)); -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3)); - -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1, - 'release_deps' => array( - array('type' => 'pkg', 'name' => 'pkg3', 'rel' => 'not') - ))); - -$dep = new PEAR_Dependency($reg); -$msg = ''; -$warn = ''; -$ret = $dep->checkPackageUninstall($msg, $warn, 'pkg1'); -echo 'uninstall ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; -echo $warn . "\n"; - -cleanall(); - -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2)); -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3)); - -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1, - 'release_deps' => array( - array('type' => 'pkg', 'name' => 'pkg2', 'rel' => 'ne', 'version' => '6.0') - ))); - -$dep = new PEAR_Dependency($reg); -$msg = ''; -$warn = ''; -$ret = $dep->checkPackageUninstall($msg, $warn, 'pkg2'); -echo 'uninstall ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; -echo $warn . "\n"; - -cleanall(); - -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2)); -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3)); - -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1, - 'release_deps' => array( - array('type' => 'pkg', 'name' => 'pkg2', 'rel' => 'has') - ))); - -$dep = new PEAR_Dependency($reg); -$msg = ''; -$warn = ''; -$ret = $dep->checkPackageUninstall($msg, $warn, 'pkg2'); -echo 'uninstall ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; -echo $warn . "\n"; - -cleanall(); - -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2)); -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3)); - -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1, - 'release_deps' => array( - array('type' => 'pkg', 'name' => 'pkg2', 'rel' => 'has', 'optional' => 'no') - ))); - -$dep = new PEAR_Dependency($reg); -$msg = ''; -$warn = ''; -$ret = $dep->checkPackageUninstall($msg, $warn, 'pkg2'); -echo 'uninstall ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; -echo $warn . "\n"; - -cleanall(); - -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2)); -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3)); - -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1, - 'release_deps' => array( - array('type' => 'pkg', 'name' => 'pkg2', 'rel' => 'has', 'optional' => 'yes') - ))); - -$dep = new PEAR_Dependency($reg); -$msg = ''; -$warn = ''; -$ret = $dep->checkPackageUninstall($msg, $warn, 'pkg2'); -echo 'uninstall ok? '; -echo $ret ? "no\n" : "yes\n"; -echo $msg . "\n"; -echo $warn . "\n"; - -cleanall(); - -// ------------------------------------------------------------------------- // - -function cleanall() -{ - $dp = opendir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); - while ($ent = readdir($dp)) { - if (substr($ent, -4) == ".reg") { - unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp' . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'checkPackagetmp'); -} - -?> ---EXPECT-- -uninstall ok? yes - - -uninstall ok? yes - - -uninstall ok? no -Package 'pear::pkg1' depends on 'pear::pkg2' - - -uninstall ok? no -Package 'pear::pkg1' depends on 'pear::pkg2' - - -uninstall ok? yes - - -Warning: Package 'pear::pkg1' optionally depends on 'pear::pkg2'
\ No newline at end of file diff --git a/pear/tests/pear_downloader_invalid.phpt b/pear/tests/pear_downloader_invalid.phpt deleted file mode 100644 index 7c10dcd80b..0000000000 --- a/pear/tests/pear_downloader_invalid.phpt +++ /dev/null @@ -1,379 +0,0 @@ ---TEST-- -PEAR_Downloader::download() invalid values test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -$server = 'pear.Chiara'; -//$server = 'test.pear.php.net'; -$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'); -} -if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'cache')) { - mkdir($temp_path . DIRECTORY_SEPARATOR . 'cache'); -} -// make the fake configuration - we'll use one of these and it should work -$config = serialize(array('master_server' => $server, - 'preferred_state' => 'stable', - 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', - 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', - 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', - 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', - 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', - 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', - 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); -touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); -fwrite($fp, $config); -fclose($fp); -touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); -fwrite($fp, $config); -fclose($fp); - -putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); -$home = getenv('HOME'); -if (!empty($home)) { - // for PEAR_Config initialization - putenv('HOME="'.$temp_path); -} -require_once "PEAR/Downloader.php"; -require_once 'PEAR/Installer.php'; -require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc'; - -// no UI is needed for these tests -$ui = false; -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} - -$config = &PEAR_Config::singleton(); -// initialize fake pear channel -require_once 'PEAR/ChannelFile.php'; -$chan = new PEAR_ChannelFile; -$chan->setName('pear'); -$chan->setSummary('PEAR'); -$chan->setServer($server); -$chan->setDefaultPEARProtocols(); -$reg = new PEAR_Registry($config->get('php_dir'), $chan); -$options = array(); -$installer = &new test_PEAR_Downloader($ui, $options, $config); - -echo "-=-=-=-=-=-=-=-=- Failure Tests -=-=-=-=-=-=-=-=-=-=-\n"; - -echo "Test invalid package name:\n"; -$packages = array("/invalid+packagename"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); - -echo "Test download of a package with no releases:\n"; -$packages = array("noreleases"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); - -echo "Test download of a non-existing package version:\n"; -$packages = array("pkg1-1976.9.2"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); - -echo "Test download of a non-existing package release state:\n"; -$packages = array("pkg1-snapshot"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); - -echo "Test download of invalid release state:\n"; -$packages = array("pkg1-burgerking"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); - -$installer->configSet('preferred_state', 'stable'); - -echo "Test automatic version resolution (stable):\n"; -$packages = array("stabilitytoolow"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); - -echo "Test automatic version resolution (stable) with --force:\n"; -$packages = array("stabilitytoolow"); -$installer->setOptions(array('force' => true)); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); - -$installer->configSet('preferred_state', 'beta'); -$installer->setOptions(array()); - -echo "Test automatic version resolution (beta):\n"; -$packages = array("stabilitytoolow"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); - -$installer->configSet('preferred_state', 'alpha'); - -echo "Test automatic version resolution (alpha):\n"; -$packages = array("stabilitytoolow"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); - -$installer->configSet('preferred_state', 'devel'); - -echo "Test automatic version resolution (devel):\n"; -$packages = array("stabilitytoolow"); -$a = $installer->doDownload($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); - -echo "Test download attempt if a version is already installed:\n"; - -$forinstall = &new PEAR_Installer($ui); -$forinstall->setOptions(array()); -$installer->setOptions(array()); - -$installer->doDownload(array('pkg6')); -$pkgs = $installer->getDownloadedPackages(); -$forinstall->install($pkgs[0]['file']); -$installer->doDownload(array('pkg6')); -var_dump(get_class($a), $installer->getErrorMsgs()); - -echo "Test download attempt if a version is already installed with --force:\n"; - -$installer->setOptions(array('force' => true)); - -$installer->doDownload(array('pkg6')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs(), $pkgs[0]['info']['version']); - -echo "Test download attempt if a version is already installed with upgrade, same version:\n"; - -$installer->setOptions(array('upgrade' => true)); - -$installer->doDownload(array('pkg6')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs()); - -echo "Test download attempt if a version is already installed with upgrade, lesser version:\n"; - -$installer->setOptions(array('upgrade' => true)); - -$installer->doDownload(array('pkg6-1.1')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs()); - -echo "Test download attempt with --alldeps, but dependency has no releases:\n"; - -$installer->setOptions(array('alldeps' => true)); - -$installer->doDownload(array('depnoreleases')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs()); - -echo "Test download attempt with --onlyreqdeps, but dependency has no releases:\n"; - -$installer->setOptions(array('onlyreqdeps' => true)); - -$installer->doDownload(array('depnoreleases')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs()); - -$installer->configSet('preferred_state', 'stable'); -echo "Test download attempt with --alldeps, but dependency is too unstable:\n"; -$installer->setOptions(array('alldeps' => true)); - -$installer->doDownload(array('depunstable')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs()); - -echo "Test download attempt with --onlyreqdeps, but dependency is too unstable:\n"; - -$installer->setOptions(array('onlyreqdeps' => true)); - -$installer->doDownload(array('depunstable')); -$pkgs = $installer->getDownloadedPackages(); -var_dump(get_class($a), $installer->getErrorMsgs()); - -chdir($curdir); -cleanall($temp_path); - -//echo implode("\n", array_values($GLOBALS['totalPHP'])); - - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- --=-=-=-=-=-=-=-=- Failure Tests -=-=-=-=-=-=-=-=-=-=- -Test invalid package name: -Caught error: Package name '/invalid+packagename' not valid for channel 'pear' -string(10) "pear_error" -array(0) { -} -array(0) { -} -Test download of a package with no releases: -Caught error: No releases found for package 'pear::noreleases' -string(10) "pear_error" -array(0) { -} -array(0) { -} -Test download of a non-existing package version: -Caught error: No release of 'pear::pkg1' with version '1976.9.2' found, latest release is version '2.0b1', stability 'beta', use --force to install -string(10) "pear_error" -array(0) { -} -array(0) { -} -Test download of a non-existing package release state: -Caught error: No release of 'pear::pkg1' with state 'snapshot' found, latest release is version '2.0b1', stability 'beta', use --force to install -string(10) "pear_error" -array(0) { -} -array(0) { -} -Test download of invalid release state: -Caught error: Invalid suffix '-burgerking', be sure to pass a valid PEAR version number or release state -string(10) "pear_error" -array(0) { -} -array(0) { -} -Test automatic version resolution (stable): -Caught error: No release of 'pear::stabilitytoolow' within preferred_state of 'stable' found, latest release is version '3.0dev', stability 'devel', use --force to install -string(10) "pear_error" -array(0) { -} -array(0) { -} -Test automatic version resolution (stable) with --force: -Warning: No release of 'pear::stabilitytoolow' within preferred_state of 'stable' found, latest release, version '3.0dev', stability 'devel' will be downloaded -bool(false) -array(0) { -} -string(6) "3.0dev" -Test automatic version resolution (beta): -bool(false) -array(0) { -} -string(5) "1.0b1" -Test automatic version resolution (alpha): -bool(false) -array(0) { -} -string(5) "2.0a1" -Test automatic version resolution (devel): -bool(false) -array(0) { -} -string(6) "3.0dev" -Test download attempt if a version is already installed: -Package 'pear::pkg6' already installed, skipping -bool(false) -array(0) { -} -Test download attempt if a version is already installed with --force: -bool(false) -array(0) { -} -string(5) "2.0b1" -Test download attempt if a version is already installed with upgrade, same version: -Package 'pear::pkg6', version '2.0b1' already installed, skipping -bool(false) -array(0) { -} -Test download attempt if a version is already installed with upgrade, lesser version: -Package 'pear::pkg6' version '2.0b1' is installed and 2.0b1 is > requested '1.1', skipping -bool(false) -array(0) { -} -Test download attempt with --alldeps, but dependency has no releases: -bool(false) -array(1) { - [0]=> - string(75) "Package 'pear::depnoreleases' dependency 'pear::noreleases' has no releases" -} -Test download attempt with --onlyreqdeps, but dependency has no releases: -bool(false) -array(1) { - [0]=> - string(75) "Package 'pear::depnoreleases' dependency 'pear::noreleases' has no releases" -} -Test download attempt with --alldeps, but dependency is too unstable: -bool(false) -array(1) { - [0]=> - string(103) "Release for 'pear::depunstable' dependency 'pear::stabilitytoolow' has state 'devel', requires 'stable'" -} -Test download attempt with --onlyreqdeps, but dependency is too unstable: -bool(false) -array(1) { - [0]=> - string(103) "Release for 'pear::depunstable' dependency 'pear::stabilitytoolow' has state 'devel', requires 'stable'" -}
\ No newline at end of file diff --git a/pear/tests/pear_downloader_new.phpt b/pear/tests/pear_downloader_new.phpt deleted file mode 100644 index bcbbf026a5..0000000000 --- a/pear/tests/pear_downloader_new.phpt +++ /dev/null @@ -1,578 +0,0 @@ ---TEST-- -PEAR_Downloader::download() test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -$server = 'pear.Chiara'; -//$server = 'test.pear.php.net'; -$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'); -} -if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'cache')) { - mkdir($temp_path . DIRECTORY_SEPARATOR . 'cache'); -} -// make the fake configuration - we'll use one of these and it should work -$config = serialize(array('master_server' => $server, - 'preferred_state' => 'stable', - 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', - 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', - 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', - 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', - 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', - 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', - 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); -touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); -fwrite($fp, $config); -fclose($fp); -touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); -fwrite($fp, $config); -fclose($fp); - -putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); -$home = getenv('HOME'); -if (!empty($home)) { - // for PEAR_Config initialization - putenv('HOME="'.$temp_path); -} -require_once "PEAR/Downloader.php"; -require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc'; - -// no UI is needed for these tests -$ui = false; -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} - -echo "Test simple direct url download:\n"; - -$config = &PEAR_Config::singleton(); -// initialize fake pear channel -require_once 'PEAR/ChannelFile.php'; -$chan = new PEAR_ChannelFile; -$chan->setName('pear'); -$chan->setSummary('PEAR'); -$chan->setServer($server); -$chan->setDefaultPEARProtocols(); - -$reg = new PEAR_Registry($config->get('php_dir'), $chan); -$packages = array("http://$server/get/pkg6-1.1.tgz"); -$options = array(); -$installer = &new test_PEAR_Downloader($ui, $options, $config); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']); -var_dump($installpackages); - -echo "Test simple package name download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6'); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']); -var_dump($installpackages); - -echo "Test package name with version download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6-1.1'); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); - -echo "Test package name with state stable download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6-stable'); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); - -echo "Test package name with state beta download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6-beta'); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); - -echo "================\nTest preferred_state = beta\n"; -$installer->configSet('preferred_state', 'beta'); - -echo "Test simple package name download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6'); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']); - -echo "\n================Test --alldeps\nTest preferred_state = stable\n"; -$installer->configSet('preferred_state', 'stable'); - -$installer = &new test_PEAR_Downloader($ui, array('alldeps' => true), $config); -$packages = array("http://$server/get/pkg1-1.1.tgz"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} -$packages = array("pkg1"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = beta:\n"; -$installer->configSet('preferred_state', 'beta'); - -$packages = array("pkg1"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = alpha:\n"; -$installer->configSet('preferred_state', 'alpha'); - -$packages = array("pkg1"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} -echo "\n================Test --onlyreqdeps\nTest preferred_state = stable\n"; -$config->set('preferred_state', 'stable'); - -$installer = &new test_PEAR_Downloader($ui, array('onlyreqdeps' => true), $config); -$packages = array("http://$server/get/pkg1-1.1.tgz"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} -$packages = array("pkg1"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = beta:\n"; -$installer->configSet('preferred_state', 'beta'); - -$packages = array("pkg1"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = alpha:\n"; -$installer->configSet('preferred_state', 'alpha'); - -$packages = array("pkg1"); -$a = $installer->download($packages); -$installpackages = $installer->getDownloadedPackages(); -var_dump($a, $installer->getErrorMsgs()); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - - -chdir($curdir); -cleanall($temp_path); -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -Test simple direct url download: -NULL -array(0) { -} -File exists? yes -File is the same? yes -array(1) { - [0]=> - array(2) { - ["pkg"]=> - string(4) "pkg6" - ["info"]=> - array(11) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - array(3) { - ["zoorb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\oggbrzitzkee.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\Mopreeb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - } - ["package"]=> - string(4) "pkg6" - ["summary"]=> - string(32) "required test for PEAR_Installer" - ["description"]=> - string(12) "fake package" - ["maintainers"]=> - array(1) { - [0]=> - array(4) { - ["handle"]=> - string(8) "fakeuser" - ["name"]=> - string(9) "Joe Shmoe" - ["email"]=> - string(18) "nobody@example.com" - ["role"]=> - string(4) "lead" - } - } - ["version"]=> - string(3) "1.1" - ["release_date"]=> - string(10) "2003-09-09" - ["release_license"]=> - string(11) "PHP License" - ["release_state"]=> - string(6) "stable" - ["release_notes"]=> - string(24) "required dependency test" - } - } -} -Test simple package name download: -NULL -array(0) { -} -File exists? yes -File is the same? yes -array(1) { - [0]=> - array(2) { - ["pkg"]=> - string(4) "pkg6" - ["info"]=> - array(11) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - array(3) { - ["zoorb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\oggbrzitzkee.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\Mopreeb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - } - ["package"]=> - string(4) "pkg6" - ["summary"]=> - string(32) "required test for PEAR_Installer" - ["description"]=> - string(12) "fake package" - ["maintainers"]=> - array(1) { - [0]=> - array(4) { - ["handle"]=> - string(8) "fakeuser" - ["name"]=> - string(9) "Joe Shmoe" - ["email"]=> - string(18) "nobody@example.com" - ["role"]=> - string(4) "lead" - } - } - ["version"]=> - string(3) "1.1" - ["release_date"]=> - string(10) "2003-09-09" - ["release_license"]=> - string(11) "PHP License" - ["release_state"]=> - string(6) "stable" - ["release_notes"]=> - string(24) "required dependency test" - } - } -} -Test package name with version download: -NULL -array(0) { -} -File exists? yes -File is the same? yes -Test package name with state stable download: -NULL -array(0) { -} -File exists? yes -File is the same? yes -Test package name with state beta download: -NULL -array(0) { -} -File exists? yes -File is the same? yes -================ -Test preferred_state = beta -Test simple package name download: -NULL -array(0) { -} -File exists? yes -File is the same? yes - -================Test --alldeps -Test preferred_state = stable -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -Test preferred_state = beta: -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1 -Test preferred_state = alpha: -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.4 -pkg4AndAHalf-1.3 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1 - -================Test --onlyreqdeps -Test preferred_state = stable -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -Test preferred_state = beta: -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1 -Test preferred_state = alpha: -skipping Package 'pear::pkg3' optional dependency 'pear::pkg4AndAHalf' -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.4 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1
\ No newline at end of file diff --git a/pear/tests/pear_downloader_old.phpt b/pear/tests/pear_downloader_old.phpt deleted file mode 100644 index 6e7225f44b..0000000000 --- a/pear/tests/pear_downloader_old.phpt +++ /dev/null @@ -1,609 +0,0 @@ ---TEST-- -PEAR_Installer test: PEAR_Installer::download() (deprecated) ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php -if (!defined('PATH_SEPARATOR')) { - define('PATH_SEPARATOR', (DIRECTORY_SEPARATOR == '/') ? ':' : ';'); -} -ini_set('include_path', dirname(__FILE__) . PATH_SEPARATOR . ini_get('include_path')); -$server = 'pear.Chiara'; -//$server = 'test.pear.php.net'; -$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'); -} -if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'cache')) { - mkdir($temp_path . DIRECTORY_SEPARATOR . 'cache'); -} -// make the fake configuration - we'll use one of these and it should work -$config = serialize(array('master_server' => $server, - 'preferred_state' => 'stable', - 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', - 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', - 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', - 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', - 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', - 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', - 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); -touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); -fwrite($fp, $config); -fclose($fp); -touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); -fwrite($fp, $config); -fclose($fp); - -putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); -$home = getenv('HOME'); -if (!empty($home)) { - // for PEAR_Config initialization - putenv('HOME="'.$temp_path); -} -require_once "PEAR/Installer.php"; -require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc'; -//echo 1; -// no UI is needed for these tests -$ui = false; -$installer = new test_PEAR_Installer($ui); -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); -set_error_handler('catchphp'); - -function catchphp($errno, $errmsg) -{ - if (error_reporting() == 0) { - return; - } - $errlevel = array( - E_USER_NOTICE => 'Notice', - E_USER_WARNING => 'Warning', - E_USER_ERROR => 'Error', - E_WARNING => 'Warning', - E_NOTICE => 'Notice' - ); - echo $errlevel[$errno] . ': ' . $errmsg . "\n"; -} -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} - -echo "Test simple direct url download:\n"; - -$config = &PEAR_Config::singleton(); -// initialize fake pear channel -require_once 'PEAR/ChannelFile.php'; -$chan = new PEAR_ChannelFile; -$chan->setName('pear'); -$chan->setSummary('PEAR'); -$chan->setServer($server); -$chan->setDefaultPEARProtocols(); -$reg = new PEAR_Registry($config->get('php_dir'), $chan); -$packages = array("http://$server/get/pkg6-1.1.tgz"); -$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); -var_dump($a, $errors); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']); -var_dump($installpackages); - -echo "Test simple package name download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6'); -$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); -var_dump($a, $errors); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']); -var_dump($installpackages); - -echo "Test package name with version download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6-1.1'); -$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); -var_dump($a, $errors); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); - -echo "Test package name with state stable download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6-stable'); -$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); -var_dump($a, $errors); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); - -echo "Test package name with state beta download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6-beta'); -$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); -var_dump($a, $errors); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); - -echo "================\nTest preferred_state = beta\n"; -$config->set('preferred_state', 'beta'); - -echo "Test simple package name download:\n"; -$installpackages = $errors = array(); -$packages = array('pkg6'); -$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); -var_dump($a, $errors); - -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']); - -echo "\n================Test --alldeps\nTest preferred_state = stable\n"; -$config->set('preferred_state', 'stable'); - -$config = &PEAR_Config::singleton(); -$packages = array("http://$server/get/pkg1-1.1.tgz"); -$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} -$packages = array("pkg1"); -$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = beta:\n"; -$config->set('preferred_state', 'beta'); - -$config = &PEAR_Config::singleton(); -$packages = array("pkg1"); -$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = alpha:\n"; -$config->set('preferred_state', 'alpha'); - -$config = &PEAR_Config::singleton(); -$packages = array("pkg1"); -$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} -echo "\n================Test --onlyreqdeps\nTest preferred_state = stable\n"; -$config->set('preferred_state', 'stable'); - -$config = &PEAR_Config::singleton(); -$packages = array("http://$server/get/pkg1-1.1.tgz"); -$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} -$packages = array("pkg1"); -$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = beta:\n"; -$config->set('preferred_state', 'beta'); - -$config = &PEAR_Config::singleton(); -$packages = array("pkg1"); -$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - -echo "Test preferred_state = alpha:\n"; -$config->set('preferred_state', 'alpha'); - -$config = &PEAR_Config::singleton(); -$packages = array("pkg1"); -$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); -var_dump($a, $errors); -echo "Packages downloaded and version:\n"; -foreach ($installpackages as $package) { - echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; -} - - -chdir($curdir); -cleanall($temp_path); - -/* -echo "File exists? "; -echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; -echo "File is the same? "; -$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); -$dled = implode('', file($installpackages[0]['file'])); -echo ($good == $dled) ? "yes\n" : "no\n"; -unlink($installpackages[0]['file']); -unset($installpackages[0]['file']);*/ -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -Test simple direct url download: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -File exists? yes -File is the same? yes -array(1) { - [0]=> - array(2) { - ["pkg"]=> - string(4) "pkg6" - ["info"]=> - array(11) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - array(3) { - ["zoorb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\oggbrzitzkee.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\Mopreeb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - } - ["package"]=> - string(4) "pkg6" - ["summary"]=> - string(32) "required test for PEAR_Installer" - ["description"]=> - string(12) "fake package" - ["maintainers"]=> - array(1) { - [0]=> - array(4) { - ["handle"]=> - string(8) "fakeuser" - ["name"]=> - string(9) "Joe Shmoe" - ["email"]=> - string(18) "nobody@example.com" - ["role"]=> - string(4) "lead" - } - } - ["version"]=> - string(3) "1.1" - ["release_date"]=> - string(10) "2003-09-09" - ["release_license"]=> - string(11) "PHP License" - ["release_state"]=> - string(6) "stable" - ["release_notes"]=> - string(24) "required dependency test" - } - } -} -Test simple package name download: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -File exists? yes -File is the same? yes -array(1) { - [0]=> - array(2) { - ["pkg"]=> - string(4) "pkg6" - ["info"]=> - array(11) { - ["provides"]=> - array(0) { - } - ["filelist"]=> - array(3) { - ["zoorb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\oggbrzitzkee.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - ["goompness\Mopreeb.php"]=> - array(2) { - ["role"]=> - string(3) "php" - ["baseinstalldir"]=> - string(5) "groob" - } - } - ["package"]=> - string(4) "pkg6" - ["summary"]=> - string(32) "required test for PEAR_Installer" - ["description"]=> - string(12) "fake package" - ["maintainers"]=> - array(1) { - [0]=> - array(4) { - ["handle"]=> - string(8) "fakeuser" - ["name"]=> - string(9) "Joe Shmoe" - ["email"]=> - string(18) "nobody@example.com" - ["role"]=> - string(4) "lead" - } - } - ["version"]=> - string(3) "1.1" - ["release_date"]=> - string(10) "2003-09-09" - ["release_license"]=> - string(11) "PHP License" - ["release_state"]=> - string(6) "stable" - ["release_notes"]=> - string(24) "required dependency test" - } - } -} -Test package name with version download: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -File exists? yes -File is the same? yes -Test package name with state stable download: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -File exists? yes -File is the same? yes -Test package name with state beta download: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -File exists? yes -File is the same? yes -================ -Test preferred_state = beta -Test simple package name download: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -File exists? yes -File is the same? yes - -================Test --alldeps -Test preferred_state = stable -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -Test preferred_state = beta: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1 -Test preferred_state = alpha: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.4 -pkg4AndAHalf-1.3 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1 - -================Test --onlyreqdeps -Test preferred_state = stable -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-1.1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-1.1 -Test preferred_state = beta: -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.1 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1 -Test preferred_state = alpha: -skipping Package 'pear::pkg3' optional dependency 'pear::pkg4AndAHalf' -Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class -NULL -array(0) { -} -Packages downloaded and version: -pkg1-2.0b1 -pkg2-1.1 -pkg3-1.4 -pkg4-1.1 -pkg5-1.1 -pkg6-2.0b1
\ No newline at end of file diff --git a/pear/tests/pear_error.phpt b/pear/tests/pear_error.phpt deleted file mode 100644 index 2a77cf497d..0000000000 --- a/pear/tests/pear_error.phpt +++ /dev/null @@ -1,156 +0,0 @@ ---TEST-- -PEAR_Error: basic test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php // -*- PHP -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::isError static method - -include_once "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"; - -?> ---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 9dbfa3b22c..0000000000 --- a/pear/tests/pear_error2.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -PEAR_Error: die mode ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php // -*- C++ -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::isError static method -// testing PEAR_Error - -include_once "PEAR.php"; - -error_reporting(E_ALL); - -print "mode=die: "; -$err = new PEAR_Error("test error!!\n", -42, PEAR_ERROR_DIE); -print $err->toString() . "\n"; - -?> ---EXPECT-- -mode=die: test error!! diff --git a/pear/tests/pear_error3.phpt b/pear/tests/pear_error3.phpt deleted file mode 100644 index 2e5ce8d2a2..0000000000 --- a/pear/tests/pear_error3.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -PEAR_Error: default error handling ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php // -*- PHP -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::setErrorHandling -// - PEAR::raiseError method - -include_once "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 0d6754c88b..0000000000 --- a/pear/tests/pear_error4.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---TEST-- -PEAR_Error: expected errors ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php // -*- PHP -*- - -// Test for: PEAR.php -// Parts tested: - PEAR_Error class -// - PEAR::expectError -// - PEAR::popExpect - -include_once "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 9daf2ecf07..0000000000 --- a/pear/tests/pear_installer1.phpt +++ /dev/null @@ -1,213 +0,0 @@ ---TEST-- -PEAR_Installer test extractDownloadFileName, checkDeps ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php - -require_once "PEAR/Installer.php"; -require_once 'PEAR/ChannelFile.php'; - -$temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'; -if (!is_dir($temp_path)) { - mkdir($temp_path); -} -touch($temp_path . DIRECTORY_SEPARATOR . 'user.conf'); -// no UI is needed for these tests -$ui = false; -$config = new PEAR_Config($temp_path . DIRECTORY_SEPARATOR . 'user.conf'); -$config->set('php_dir', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'); -$reg = &new PEAR_Registry($config->get('php_dir')); -$chan = new PEAR_ChannelFile; -$chan->setName('oddball'); -$chan->setServer('example.com'); -$chan->setSummary('oddball'); -$chan->setPackageNameRegex('[a-z][a-z0-9]*(?:\.[a-z0-9]+)*'); -$reg->addChannel($chan); -$installer = new PEAR_Installer($ui); -$installer->config = &$config; -echo "test extractDownloadFileName:\n"; -echo 'existing file: '; -echo ($temp_path . DIRECTORY_SEPARATOR . 'user.conf' == - $installer->extractDownloadFileName($temp_path . DIRECTORY_SEPARATOR . 'user.conf', - $ui)) ? "yes\n" : "no\n"; -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 "valid match, has unknown channel:\n"; -var_dump($installer->extractDownloadFileName('Unknown::Testpackage', $ui)); -var_dump($ui); -echo "invalid match, has known channel, invalid package name:\n"; -var_dump($installer->extractDownloadFileName('Oddball::Testpackage', $ui)); -var_dump($ui); -echo "valid match, has known channel, valid package name:\n"; -var_dump($installer->extractDownloadFileName('Oddball::testpackage.third3', $ui)); -var_dump($ui); -echo "valid match, has known channel, valid package name, version:\n"; -var_dump($installer->extractDownloadFileName('Oddball::testpackage.third3-54.7354', $ui)); -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); - -echo "\ntest checkDeps 1.1:\n"; -$fakerel = array('release_deps' => -array( - array( - 'type' => 'pkg', - 'rel '=> 'has', - 'name' => 'foo', - 'optional' => 'yes', - 'channel' => 'grob', - ), - array( - 'type' => 'pkg', - 'rel '=> 'ge', - 'version' => '1.6', - 'name' => 'bar', - 'channel' => 'prego', - ), -)); -$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); -$fakerel = array('release_deps' => -array( - array( - 'type' => 'pkg', - 'rel '=> 'has', - 'name' => 'foo', - 'optional' => 'yes', - 'channel' => 'purple', - ), -)); -echo "\ntest checkDeps 2.1:\n"; -$res = ''; -var_dump($installer->checkDeps($fakerel, $res)); -var_dump($res); -cleanall($temp_path); -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -test extractDownloadFileName: -existing file: yes -bool(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" -valid match, has unknown channel: -array(2) { - ["channel"]=> - string(7) "Unknown" - ["package"]=> - string(11) "Testpackage" -} -NULL -invalid match, has known channel, invalid package name: -string(20) "Oddball::Testpackage" -NULL -valid match, has known channel, valid package name: -array(2) { - ["channel"]=> - string(7) "Oddball" - ["package"]=> - string(18) "testpackage.third3" -} -NULL -valid match, has known channel, valid package name, version: -array(2) { - ["channel"]=> - string(7) "Oddball" - ["package"]=> - string(18) "testpackage.third3" -} -string(7) "54.7354" - -test checkDeps 1: -bool(true) -string(29) " -requires package `pear::bar'" - -test checkDeps 1.1: -bool(true) -string(30) " -requires package `prego::bar'" - -test checkDeps 2: -bool(false) -string(83) "Optional dependencies: -package `pear::foo' is recommended to utilize some features." - -test checkDeps 2.1: -bool(false) -string(85) "Optional dependencies: -package `purple::foo' is recommended to utilize some features."
\ No newline at end of file diff --git a/pear/tests/pear_installer2.phpt b/pear/tests/pear_installer2.phpt deleted file mode 100644 index 541ad71b76..0000000000 --- a/pear/tests/pear_installer2.phpt +++ /dev/null @@ -1,398 +0,0 @@ ---TEST-- -PEAR_Installer test _installFile() ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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() == 'bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . - DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php' ? 'match' : 'no match') . "\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"; -ob_start(); -$err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', 'md5sum' => md5('oops stuff')), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array('force' => true)); -$warning = ob_get_contents(); -ob_end_clean(); -echo 'warning : '; -echo ($warning == 'warning : bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . - DIRECTORY_SEPARATOR . "installer2.phpt.testfile.php\n" ? "match\n" : "no match\n"); -echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); -if (is_object($err)) { - echo 'message: ' . ($err->getMessage() == 'bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . - DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php' ? 'match' : 'no match') . "\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(); - -//cleanup -chdir($curdir); -cleanall($temp_path); - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---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: match -file bin/.tmpinstaller2.phpt.testfile.php exists? => no -test invalid md5sum with --force: -warning : match -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 f997ab7e4d..0000000000 --- a/pear/tests/pear_installer3.phpt +++ /dev/null @@ -1,415 +0,0 @@ ---TEST-- -PEAR_Installer test #3 File Transactions ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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); -?> ---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_installer4.phpt b/pear/tests/pear_installer4.phpt deleted file mode 100644 index 593d38ad45..0000000000 --- a/pear/tests/pear_installer4.phpt +++ /dev/null @@ -1,266 +0,0 @@ ---TEST-- -PEAR_Installer test #4: PEAR_Installer::install() ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); - -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} - -echo "Test package.xml direct install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'package.xml'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; - -echo "Test conflicting files:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'conflictpackage.xml'); - -echo "After uninstall:\n"; -$installer->uninstall('pkg6'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "goompness exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness')) - ? "yes\n" : "no\n"; - -echo "Test .tgz install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "After uninstall:\n"; -$installer->uninstall('pkg6'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "goompness exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness')) - ? "yes\n" : "no\n"; - -echo "Test invalid .tgz install:\n"; -$error_to_catch = 'unable to unpack ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . - 'test-pkg6' . DIRECTORY_SEPARATOR . 'invalidtgz.tgz'; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'invalidtgz.tgz'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; - -echo "Test missing package.xml in .tgz install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'nopackagexml.tgz'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; - -chdir($curdir); -cleanall($temp_path); - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -Test package.xml direct install: -array(1) { - [0]=> - string(4) "pkg6" -} -zoorb.php exists? yes -goompness/Mopreeb.php exists? yes -goompness/oggbrzitzkee.php exists? yes -Test conflicting files: -Caught error: pear::pkg6conflict: conflicting files found: -groob\goompness\oggbrzitzkee.php (pkg6) - groob\goompness\Mopreeb.php (pkg6) - -After uninstall: -array(0) { -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no -goompness exists? no -Test .tgz install: -array(1) { - [0]=> - string(4) "pkg6" -} -zoorb.php exists? yes -goompness/Mopreeb.php exists? yes -goompness/oggbrzitzkee.php exists? yes -After uninstall: -array(0) { -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no -goompness exists? no -Test invalid .tgz install: -Caught error: Invalid checksum for file "<?xml version="1.0" encoding="ISO-8859-1" ?> - <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/" : 37649 calculated, 0 expected -Caught expected error -array(0) { -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no -Test missing package.xml in .tgz install: -warning : you are using an archive with an old format -Caught error: no package.xml file after extracting the archive -array(0) { -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no diff --git a/pear/tests/pear_installer5.phpt b/pear/tests/pear_installer5.phpt deleted file mode 100644 index 2996e2e6bf..0000000000 --- a/pear/tests/pear_installer5.phpt +++ /dev/null @@ -1,224 +0,0 @@ ---TEST-- -PEAR_Installer test #5: test directory tracking/deletion of installation ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); - -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} - -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package.xml'); -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package2.xml'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -$info = $reg->packageInfo('pkg1'); -echo "pkg1 dir tree contains test/? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test'])) ? "yes\n" : "no\n"; -echo "pkg1 dir tree contains test/multiplepackages? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages'])) ? "yes\n" : "no\n"; -echo "pkg1 dir tree contains test/pkg1? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'pkg1'])) ? "yes\n" : "no\n"; - -$info = $reg->packageInfo('pkg2'); -echo "pkg2 dir tree contains test/? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test'])) ? "yes\n" : "no\n"; -echo "pkg2 dir tree contains test/multiplepackages? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages'])) ? "yes\n" : "no\n"; -echo "pkg2 dir tree contains test/nestedroot? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot'])) ? "yes\n" : "no\n"; -echo "pkg2 dir tree contains test/nestedroot/emptydir? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' - . DIRECTORY_SEPARATOR . 'emptydir'])) ? "yes\n" : "no\n"; -echo "pkg2 dir tree contains test/nestedroot/emptydir/nesteddir? "; -echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' - . DIRECTORY_SEPARATOR . 'emptydir' . DIRECTORY_SEPARATOR . 'nesteddir'])) ? "yes\n" : "no\n"; - -echo "After uninstall of pkg1:\n"; -$installer->uninstall('pkg1'); -echo "test/ exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test')) ? "yes\n" : "no\n"; -echo "test/multiplepackages exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages')) ? "yes\n" : "no\n"; -echo "test/pkg1 exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'pkg1')) ? "yes\n" : "no\n"; -echo "test/nestedroot exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot')) ? "yes\n" : "no\n"; -echo "test/nestedroot/emptydir exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' - . DIRECTORY_SEPARATOR . 'emptydir')) ? "yes\n" : "no\n"; -echo "test/nestedroot/emptydir/nesteddir exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' - . DIRECTORY_SEPARATOR . 'emptydir'. DIRECTORY_SEPARATOR . 'nesteddir')) ? "yes\n" : "no\n"; -var_dump($reg->listPackages()); - -echo "After uninstall of pkg2:\n"; -$installer->uninstall('pkg2'); -echo "test/ exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test')) ? "yes\n" : "no\n"; -echo "test/multiplepackages exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages')) ? "yes\n" : "no\n"; -echo "test/pkg1 exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'pkg1')) ? "yes\n" : "no\n"; -echo "test/nestedroot exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot')) ? "yes\n" : "no\n"; -echo "test/nestedroot/emptydir exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' - . DIRECTORY_SEPARATOR . 'emptydir')) ? "yes\n" : "no\n"; -echo "test/nestedroot/emptydir/nesteddir exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' - . DIRECTORY_SEPARATOR . 'emptydir'. DIRECTORY_SEPARATOR . 'nesteddir')) ? "yes\n" : "no\n"; -var_dump($reg->listPackages()); - -chdir($curdir); -cleanall($temp_path); - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -array(2) { - [0]=> - string(4) "pkg1" - [1]=> - string(4) "pkg2" -} -pkg1 dir tree contains test/? yes -pkg1 dir tree contains test/multiplepackages? yes -pkg1 dir tree contains test/pkg1? yes -pkg2 dir tree contains test/? yes -pkg2 dir tree contains test/multiplepackages? yes -pkg2 dir tree contains test/nestedroot? yes -pkg2 dir tree contains test/nestedroot/emptydir? yes -pkg2 dir tree contains test/nestedroot/emptydir/nesteddir? yes -After uninstall of pkg1: -test/ exists? yes -test/multiplepackages exists? yes -test/pkg1 exists? no -test/nestedroot exists? yes -test/nestedroot/emptydir exists? yes -test/nestedroot/emptydir/nesteddir exists? yes -array(1) { - [0]=> - string(4) "pkg2" -} -After uninstall of pkg2: -test/ exists? no -test/multiplepackages exists? no -test/pkg1 exists? no -test/nestedroot exists? no -test/nestedroot/emptydir exists? no -test/nestedroot/emptydir/nesteddir exists? no -array(0) { -}
\ No newline at end of file diff --git a/pear/tests/pear_installer_installFile_channels.phpt b/pear/tests/pear_installer_installFile_channels.phpt deleted file mode 100644 index 376b3c5306..0000000000 --- a/pear/tests/pear_installer_installFile_channels.phpt +++ /dev/null @@ -1,447 +0,0 @@ ---TEST-- -PEAR_Installer test _installFile() with channels ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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', - 'default_channel' => 'pear', - '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 . 'tests', - 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin', - '__channels' => - array( - 'test' => array( - 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'test', - 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext' . DIRECTORY_SEPARATOR . 'test', - 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'test', - 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc' . DIRECTORY_SEPARATOR . 'test', - 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'tests', - 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test', - ), - ))); -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/Config.php'; -$config = &PEAR_Config::singleton($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -require_once 'PEAR/Registry.php'; -$reg = &new PEAR_Registry($config->get('php_dir', null, 'pear')); -require_once 'PEAR/ChannelFile.php'; -$chan = new PEAR_ChannelFile; -$chan->setName('test'); -$chan->setServer('test'); -$chan->setSummary('test'); -$reg->addChannel($chan); -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', 'channel' => 'test'); - -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 php/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'test' . - 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 ext/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'ext' . DIRECTORY_SEPARATOR . 'test' - . 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/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'test' - . 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/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'doc' . DIRECTORY_SEPARATOR . 'test' - . 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/tests/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'tests' - . 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/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 php/test/.tmp....php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'test' - . 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/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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() == 'bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . - DIRECTORY_SEPARATOR . 'test' - . DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php' ? 'match' : 'no match') . "\n"; -} -echo 'file bin/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php') ? "yes\n" : "no\n"); - -echo "test invalid md5sum with --force:\n"; -ob_start(); -$err = $installer->_installFile('installer2.phpt.testfile.php', array('role' => 'script', 'md5sum' => md5('oops stuff')), - $temp_path . DIRECTORY_SEPARATOR . 'tmp', array('force' => true)); -$warning = ob_get_contents(); -ob_end_clean(); -echo 'warning : '; -echo ($warning == 'warning : bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . - DIRECTORY_SEPARATOR . 'test' - . DIRECTORY_SEPARATOR . "installer2.phpt.testfile.php\n" ? "match\n" : "no match\n"); -echo 'returned PEAR_Error: ' . (get_class($err) == 'pear_error' ? "yes\n" : "no\n"); -if (is_object($err)) { - echo 'message: ' . ($err->getMessage() == 'bad md5sum for file ' . $temp_path . DIRECTORY_SEPARATOR . 'bin' . - DIRECTORY_SEPARATOR . 'test' - . DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php' ? 'match' : 'no match') . "\n"; -} -echo 'file bin/test/.tmpinstaller2.phpt.testfile.php exists? => '; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 'test stuff'? => "; -if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 . 'test' - . DIRECTORY_SEPARATOR . - '.tmpinstaller2.phpt.testfile.php')) -{ - $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'test' - . 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 . 'test' - . 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 . 'test' - . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . 'Mine' . DIRECTORY_SEPARATOR . '.tmpinstaller2.phpt.testfile.php')) -{ - echo "yes\n"; -} else { - echo "no\n"; -} -$installer->rollbackFileTransaction(); - -//cleanup -chdir($curdir); -cleanall($temp_path); -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---GET-- ---POST-- ---EXPECT-- -test _installFile(): -install as role="php": -int(1) -file php/test/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="ext": -int(1) -file ext/test/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="data": -int(1) -file data/test/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="doc": -int(1) -file doc/test/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="test": -int(1) -file test/tests/.tmpinstaller2.phpt.testfile.php exists? => yes -install as role="script": -int(1) -file bin/test/.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/test/.tmpinstaller2.phpt.testfile.php exists? => no -install non-existent file: -returned PEAR_Error: yes -message: file does not exist -file php/test/.tmp....php exists? => no - -test valid md5sum: -int(1) -file bin/test/.tmpinstaller2.phpt.testfile.php exists? => yes -test invalid md5sum: -returned PEAR_Error: yes -message: match -file bin/test/.tmpinstaller2.phpt.testfile.php exists? => no -test invalid md5sum with --force: -warning : match -returned PEAR_Error: no -file bin/test/.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 'test stuff'? => test 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_installer_install_channels.phpt b/pear/tests/pear_installer_install_channels.phpt deleted file mode 100644 index d4c3418d0d..0000000000 --- a/pear/tests/pear_installer_install_channels.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -PEAR_Installer test #4: PEAR_Installer::install() with channels ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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'); - mkdir($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob'); -} -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', - 'default_channel' => 'pear', - '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', - '__channels' => array( - 'frob' => array( - 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob', - )))); -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/ChannelFile.php'; -require_once 'PEAR/Registry.php'; -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -$chan = new PEAR_ChannelFile; -$chan->setName('frob'); -$chan->setSummary('test'); -$chan->setServer('test'); -$reg->addChannel($chan); -$chan->setName('groob'); -$reg->addChannel($chan); -require_once "PEAR/Installer.php"; - -// no UI is needed for these tests -$ui = false; -$installer = new PEAR_Installer($ui); -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); - -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} - -echo "Test package.xml direct install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'package2.xml'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listAllPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "goompness/test.dat exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'pkg6' - . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'test.dat')) ? "yes\n" : "no\n"; - -echo "Test conflicting files:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'conflictpackage2.xml'); - -echo "Test unknown channel:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'package2_invalid.xml'); - -echo "After uninstall:\n"; -$installer->uninstall('frob::pkg6'); -var_dump($reg->listAllPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "goompness/test.dat exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'pkg6' - . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'test.dat')) ? "yes\n" : "no\n"; - -chdir($curdir); -cleanall($temp_path); - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---GET-- ---POST-- ---EXPECT-- -Test package.xml direct install: -array(3) { - ["frob"]=> - array(1) { - [0]=> - string(4) "pkg6" - } - ["groob"]=> - array(0) { - } - ["pear"]=> - array(0) { - } -} -zoorb.php exists? yes -goompness/Mopreeb.php exists? yes -goompness/oggbrzitzkee.php exists? yes -goompness/test.dat exists? yes -Test conflicting files: -Caught error: groob::pkg6conflict: conflicting files found: -groob\goompness\oggbrzitzkee.php (frob::pkg6) - groob\goompness\Mopreeb.php (frob::pkg6) - groob\goompness\test.dat (frob::pkg6) - -Test unknown channel: -Error: Unknown channel, "gorp" -Caught error: Installation failed: invalid package file, use option force to install anyway -After uninstall: -array(3) { - ["frob"]=> - array(0) { - } - ["groob"]=> - array(0) { - } - ["pear"]=> - array(0) { - } -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no -goompness/test.dat exists? no diff --git a/pear/tests/pear_packager.phpt b/pear/tests/pear_packager.phpt deleted file mode 100644 index 141fae06d4..0000000000 --- a/pear/tests/pear_packager.phpt +++ /dev/null @@ -1,396 +0,0 @@ ---TEST-- -PEAR_Packager test ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo '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/Packager.php"; -require_once 'PEAR/Registry.php'; -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -$packager = new PEAR_Packager(); -$packager->setRegistry($reg); -$curdir = getcwd(); -chdir(dirname(__FILE__)); - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); - -$error_to_catch = false; -function catchit($err) -{ - global $error_to_catch; - if ($error_to_catch) { - if ($err->getMessage() == $error_to_catch) { - $error_to_catch = false; - echo "Caught expected error\n"; - return; - } - } - echo "Caught error: " . $err->getMessage() . "\n"; -} -ob_start(); -if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'CVS')) { - mkdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'CVS'); - touch(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'CVS' . DIRECTORY_SEPARATOR . 'Root'); -} -$packager->package(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package.xml'); -$packager->package(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package2.xml'); -$stuff = str_replace(array(dirname(__FILE__) . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array('', '/'), - ob_get_contents()); -ob_end_clean(); -echo $stuff; - -$archive1 = &new Archive_Tar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-1.0.tgz'); -$archive1c = &new Archive_Tar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . - DIRECTORY_SEPARATOR . 'pkg1-1.0.tgz'); -$x1 = $archive1->listContent(); -$x2 = $archive1c->listContent(); -for($i=0;$i<count($x1); $i++) { -// if ($x1[$i]['filename'] == 'package.xml') { - unset($x1[$i]['mtime']); - unset($x1[$i]['checksum']); -// } -} -for($i=0;$i<count($x2); $i++) { -// if ($x2[$i]['filename'] == 'package.xml') { - unset($x2[$i]['mtime']); - unset($x2[$i]['checksum']); -// } -} -var_dump($x1, $x2); -$archive1 = &new Archive_Tar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg2-1.0.tgz'); -$archive1c = &new Archive_Tar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . - DIRECTORY_SEPARATOR . 'pkg2-1.0.tgz'); -$x1 = $archive1->listContent(); -$x2 = $archive1c->listContent(); -for($i=0;$i<count($x1); $i++) { -// if ($x1[$i]['filename'] == 'package.xml') { - unset($x1[$i]['mtime']); - unset($x1[$i]['checksum']); -// } -} -for($i=0;$i<count($x2); $i++) { -// if ($x2[$i]['filename'] == 'package.xml') { - unset($x2[$i]['mtime']); - unset($x2[$i]['checksum']); -// } -} -var_dump($x1, $x2); - -echo "test failure:\n"; -$packager->package(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package-fail.xml'); - -unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-1.0.tgz'); -unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg2-1.0.tgz'); -chdir($curdir); -cleanall($temp_path); - -// ------------------------------------------------------------------------- // - -function cleanall($dir) -{ - $dp = opendir($dir); - while ($ent = readdir($dp)) { - if ($ent == '.' || $ent == '..') { - continue; - } - if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($dir . DIRECTORY_SEPARATOR . $ent); - } else { - unlink($dir . DIRECTORY_SEPARATOR . $ent); - } - } - closedir($dp); - rmdir($dir); -} -?> ---EXPECT-- -Analyzing multiplepackages/pkg1file.php -Analyzing pkg1/randomfile.php -Package pkg1-1.0.tgz done -Tag the released code with `pear cvstag package.xml' -(or set the CVS tag RELEASE_1_0 by hand) -Analyzing multiplepackages/pkg2file.php -Analyzing nestedroot/rootfile.php -Analyzing nestedroot/emptydir/nesteddir/nestedfile.php -Package pkg2-1.0.tgz done -Tag the released code with `pear cvstag package2.xml' -(or set the CVS tag RELEASE_1_0 by hand) -array(3) { - [0]=> - array(6) { - ["filename"]=> - string(11) "package.xml" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(817) - ["typeflag"]=> - string(0) "" - } - [1]=> - array(6) { - ["filename"]=> - string(38) "pkg1-1.0/multiplepackages/pkg1file.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } - [2]=> - array(6) { - ["filename"]=> - string(28) "pkg1-1.0/pkg1/randomfile.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } -} -array(3) { - [0]=> - array(6) { - ["filename"]=> - string(11) "package.xml" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(817) - ["typeflag"]=> - string(0) "" - } - [1]=> - array(6) { - ["filename"]=> - string(38) "pkg1-1.0/multiplepackages/pkg1file.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } - [2]=> - array(6) { - ["filename"]=> - string(28) "pkg1-1.0/pkg1/randomfile.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } -} -array(4) { - [0]=> - array(6) { - ["filename"]=> - string(11) "package.xml" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(921) - ["typeflag"]=> - string(0) "" - } - [1]=> - array(6) { - ["filename"]=> - string(38) "pkg2-1.0/multiplepackages/pkg2file.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } - [2]=> - array(6) { - ["filename"]=> - string(32) "pkg2-1.0/nestedroot/rootfile.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } - [3]=> - array(6) { - ["filename"]=> - string(53) "pkg2-1.0/nestedroot/emptydir/nesteddir/nestedfile.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } -} -array(4) { - [0]=> - array(6) { - ["filename"]=> - string(11) "package.xml" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(921) - ["typeflag"]=> - string(0) "" - } - [1]=> - array(6) { - ["filename"]=> - string(38) "pkg2-1.0/multiplepackages/pkg2file.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } - [2]=> - array(6) { - ["filename"]=> - string(32) "pkg2-1.0/nestedroot/rootfile.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } - [3]=> - array(6) { - ["filename"]=> - string(53) "pkg2-1.0/nestedroot/emptydir/nesteddir/nestedfile.php" - ["mode"]=> - int(33206) - ["uid"]=> - int(0) - ["gid"]=> - int(0) - ["size"]=> - int(0) - ["typeflag"]=> - string(0) "" - } -} -test failure: -Analyzing multiplepackages\pkg2file.php -Analyzing nestedroot\rootfile.php -Analyzing nestedroot\emptydir\nesteddir\nestedfile.php -Analyzing nestedroot\emptydir\nesteddir\doesntexist.php -Caught error: File does not exist: nestedroot\emptydir\nesteddir\doesntexist.php
\ No newline at end of file diff --git a/pear/tests/pear_registry.phpt b/pear/tests/pear_registry.phpt deleted file mode 100644 index 3eeed76408..0000000000 --- a/pear/tests/pear_registry.phpt +++ /dev/null @@ -1,141 +0,0 @@ ---TEST-- -PEAR_Registry ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; - exit(); -} -$statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'registry_tester'; -if (file_exists($statedir)) { - // don't delete existing directories! - echo 'skip'; -} -?> ---FILE-- -<?php - -error_reporting(E_ALL); -include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pear_registry_inc.php.inc'; -include_once "PEAR/Registry.php"; -PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n"); -$statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'registry_tester'; -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($statedir); -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); - -$testing = $reg->checkFilemap(array_merge($files3, $files2)); -$ok = ($testing == array('pkg3-1.php' => 'pkg3', 'pkg3' . DIRECTORY_SEPARATOR . 'pkg3-2.php' => 'pkg3')); -echo 'filemap OK? ' . ($ok ? "yes\n" : "no\n"); -if (!$ok) { - var_dump($testing); -} - -$reg->updatePackage("pkg3", array("filelist" => $files3_new)); -dumpall($reg); - -print "tests done\n"; -?> ---EXPECT-- -creating registry object -dumping registry... -channel pear: -dump done -dumping registry... -channel pear: -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -dump done -dumping registry... -channel pear: -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... -channel pear: -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... -channel pear: -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... -channel pear: -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... -channel pear: -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 -filemap OK? yes -dumping registry... -channel pear: -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_registry_1.1.phpt b/pear/tests/pear_registry_1.1.phpt deleted file mode 100644 index f82478b4f6..0000000000 --- a/pear/tests/pear_registry_1.1.phpt +++ /dev/null @@ -1,292 +0,0 @@ ---TEST-- -PEAR_Registry v1.1 ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; - exit(); -} -$statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'registry_tester'; -if (file_exists($statedir)) { - // don't delete existing directories! - echo 'skip'; -} -include_once 'PEAR/Registry.php'; -$pv = phpversion() . ''; -$av = $pv{0} == '4' ? 'apiversion' : 'apiVersion'; -if (!in_array($av, get_class_methods('PEAR_Registry'))) { - echo 'skip'; - exit(); -} -if (PEAR_Registry::apiVersion() != '1.1') { - echo 'skip'; -} -?> ---FILE-- -<?php -error_reporting(E_ALL); -include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pear_registry_inc.php.inc'; -include_once "PEAR/Registry.php"; -PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n"); -$statedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'registry_tester'; -cleanall(); - -$files1 = array( - "pkg1-1.php" => array( - "role" => "php", - ), - "pkg1-2.php" => array( - "role" => "php", - "baseinstalldir" => "pkg1", - ), - ); -$files1_test = array( - "pkg12-1.php" => array( - "role" => "php", - ), - "pkg12-2.php" => array( - "role" => "php", - "baseinstalldir" => "pkg1", - ), - ); -$files1_grnok = array( - "pkg32-1.php" => array( - "role" => "php", - ), - "pkg32-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($statedir); -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); - -$testing = $reg->checkFilemap(array_merge($files3, $files2)); -$ok = ($testing == array('pkg3-1.php' => 'pkg3', 'pkg3' . DIRECTORY_SEPARATOR . 'pkg3-2.php' => 'pkg3')); -echo 'filemap OK? ' . ($ok ? "yes\n" : "no\n"); -if (!$ok) { - var_dump($testing); -} - -$reg->updatePackage("pkg3", array("filelist" => $files3_new)); -dumpall($reg); - -echo "testing channel registry\n\n"; - -print "test add channel\n"; - -require_once 'PEAR/ChannelFile.php'; -$chan = new PEAR_ChannelFile; - -$chan->setName('test'); -$chan->setServer('pear.php.net'); -$chan->setSummary('hello'); -$reg->addChannel($chan); - -dumpall($reg); - -echo "test add bad channel\n"; -$chan = new PEAR_ChannelFile; - -$chan->setServer('pear.php.net'); -$chan->setSummary('hello'); -$reg->addChannel($chan); - -dumpall($reg); - -print "test add good package\n"; -$reg->addPackage('pkg1', array('name' => 'pkg1', 'version' => '1.0', 'filelist' => $files1_test), 'test'); - -dumpall($reg); - -echo "test add package with unknown channel\n"; - -var_dump($reg->addPackage('pkg2', array('name'=> 'pkg2', 'version' => '1.0', 'filelist' => $files1_grnok), 'grnok')); - -dumpall($reg); - -echo "test channel exists\n"; - -var_dump($reg->channelExists('test')); -var_dump($reg->channelExists('pear')); -var_dump($reg->channelExists('grnok')); - -echo "testing restart with new object\n"; - -unset($reg); - -$reg = &new PEAR_Registry($statedir); - -dumpall($reg); - -echo "test delete channel with packages\n"; -var_dump($reg->deleteChannel('test')); - -dumpall($reg); - -echo "test delete channel with no packages\n"; -$reg->deletePackage('pkg1', 'test'); - -var_dump($reg->deleteChannel('test')); - -dumpall($reg); - -print "tests done\n"; -?> ---EXPECT-- -creating registry object -dumping registry... -channel pear: -dump done -dumping registry... -channel pear: -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -dump done -dumping registry... -channel pear: -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... -channel pear: -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... -channel pear: -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... -channel pear: -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... -channel pear: -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 -filemap OK? yes -dumping registry... -channel pear: -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 -testing channel registry - -test add channel -dumping registry... -channel pear: -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" -channel test: -dump done -test add bad channel -caught ErrorStack error: -message: Missing channel name -code: 6 -dumping registry... -channel pear: -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" -channel test: -dump done -test add good package -dumping registry... -channel pear: -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" -channel test: -pkg1: version="1.0" filelist=array(pkg12-1.php[role=php],pkg12-2.php[role=php,baseinstalldir=pkg1]) -dump done -test add package with unknown channel -bool(false) -dumping registry... -channel pear: -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" -channel test: -pkg1: version="1.0" filelist=array(pkg12-1.php[role=php],pkg12-2.php[role=php,baseinstalldir=pkg1]) -dump done -test channel exists -bool(true) -bool(true) -bool(false) -testing restart with new object -dumping registry... -channel pear: -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" -channel test: -pkg1: version="1.0" filelist=array(pkg12-1.php[role=php],pkg12-2.php[role=php,baseinstalldir=pkg1]) -dump done -test delete channel with packages -bool(false) -dumping registry... -channel pear: -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" -channel test: -pkg1: version="1.0" filelist=array(pkg12-1.php[role=php],pkg12-2.php[role=php,baseinstalldir=pkg1]) -dump done -test delete channel with no packages -bool(true) -dumping registry... -channel pear: -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_registry_inc.php.inc b/pear/tests/pear_registry_inc.php.inc deleted file mode 100644 index 7cc395f081..0000000000 --- a/pear/tests/pear_registry_inc.php.inc +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -// ------------------------------------------------------------------------- // - -function cleanall($dir = null) -{ - if ($dir !== null) { - $statedir = $dir; - } else { - $statedir = $GLOBALS['statedir']; - } - if (file_exists($statedir)) { - $dp = opendir($statedir); - while ($ent = readdir($dp)) { - if (in_array($ent, array('.', '..'))) { - continue; - } - if (is_dir($statedir . DIRECTORY_SEPARATOR . $ent)) { - cleanall($statedir . DIRECTORY_SEPARATOR . $ent); - continue; - } - unlink($statedir . DIRECTORY_SEPARATOR . $ent); - } - closedir($dp); - rmdir($statedir); - } -} - - -function dumpall(&$reg) -{ - print "dumping registry...\n"; - $infos = $reg->allPackageInfo(); - foreach ($infos as $channel => $info) { - echo "channel $channel:\n"; - 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"; -} - -require_once 'PEAR/ErrorStack.php'; -function dump_error($err) -{ - echo "caught ErrorStack error:\n"; - echo "message: ". $err['message'] . "\n"; - echo "code: ". $err['code'] . "\n"; -} -PEAR_ErrorStack::setDefaultCallback('dump_error'); -register_shutdown_function('cleanall'); -?>
\ No newline at end of file diff --git a/pear/tests/pear_system.phpt b/pear/tests/pear_system.phpt deleted file mode 100644 index 591b3b6484..0000000000 --- a/pear/tests/pear_system.phpt +++ /dev/null @@ -1,110 +0,0 @@ ---TEST-- -System commands tests ---SKIPIF-- -<?php -if (!getenv('PHP_PEAR_RUNTESTS')) { - echo 'skip'; -} -?> ---FILE-- -<?php -error_reporting(E_ALL); -require_once 'System.php'; - -$sep = DIRECTORY_SEPARATOR; -$ereg_sep = $sep; -if (OS_WINDOWS) { - $ereg_sep .= $sep; -} -/******************* - mkDir -********************/ -// Single directory creation -System::mkDir('singledir'); -if( !is_dir('singledir') ){ - print "System::mkDir('singledir'); failed\n"; -} -System::rm('singledir'); - -// 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 = str_replace($sep, $ereg_sep, System::tmpDir()); -if (!@is_file($tmpfile) || !ereg("^$tmpenv{$ereg_sep}tst", $tmpfile)) { - print "System::mkTemp('tst') failed\n"; - var_dump(is_file($tmpfile), $tmpfile, "^$tmpenv{$ereg_sep}tst", !ereg("^$tmpenv{$ereg_sep}tst", $tmpfile)); -} - -// Create a temporal dir in "dir1" with default prefix "tmp" -$tmpdir = System::mkTemp('-d -t dir1'); -if (!@is_dir($tmpdir) || !ereg("^dir1{$ereg_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/php_dump.php.inc b/pear/tests/php_dump.php.inc deleted file mode 100644 index 4f7a666295..0000000000 --- a/pear/tests/php_dump.php.inc +++ /dev/null @@ -1,57 +0,0 @@ -<?php -class PHP_Dump { - var $_var; - function PHP_Dump($var) - { - $this->_var = $var; - } - - function toPHP() - { - return $this->_toUnknown($this->_var); - } - - function _toUnknown($var, $indent = ' ') - { - switch (gettype($var)) { - case 'array' : - return $this->_toArray($var, $indent); - case 'boolean' : - return $this->_toBool($var, $indent); - case 'double' : - case 'integer' : - return $this->_toNumber($var, $indent); - case 'NULL' : - return "{$indent}null"; - case 'string' : - return $this->_toString($var, $indent); - } - } - - function _toString($var, $indent) - { - return $indent . '"' . addslashes($var) . '"'; - } - - function _toBool($var, $indent) - { - return $indent . ($var ? 'true' : 'false'); - } - - function _toNumber($var, $indent) - { - return $indent . $var; - } - - function _toArray($var, $indent = ' ') - { - $ret = $indent . "array(\n"; - foreach ($var as $key => $value) { - $ret .= $indent . ((is_int($key) || is_double($key)) ? $key : "'$key'") . " =>\n"; - $ret .= $this->_toUnknown($value, "$indent ") . ",\n"; - } - $ret .= $indent . ')'; - return $ret; - } -} -?>
\ No newline at end of file diff --git a/pear/tests/pkg1-1.1.tgz b/pear/tests/pkg1-1.1.tgz Binary files differdeleted file mode 100644 index fb1b65ffe3..0000000000 --- a/pear/tests/pkg1-1.1.tgz +++ /dev/null diff --git a/pear/tests/pkg1-2.0b1.tgz b/pear/tests/pkg1-2.0b1.tgz Binary files differdeleted file mode 100644 index bc16f70e0a..0000000000 --- a/pear/tests/pkg1-2.0b1.tgz +++ /dev/null diff --git a/pear/tests/pkg2-1.1.tgz b/pear/tests/pkg2-1.1.tgz Binary files differdeleted file mode 100644 index 86b5d16c4c..0000000000 --- a/pear/tests/pkg2-1.1.tgz +++ /dev/null diff --git a/pear/tests/pkg3-1.1.tgz b/pear/tests/pkg3-1.1.tgz Binary files differdeleted file mode 100644 index f3746443d8..0000000000 --- a/pear/tests/pkg3-1.1.tgz +++ /dev/null diff --git a/pear/tests/pkg3-1.4.tgz b/pear/tests/pkg3-1.4.tgz Binary files differdeleted file mode 100644 index 31c9825ef2..0000000000 --- a/pear/tests/pkg3-1.4.tgz +++ /dev/null diff --git a/pear/tests/pkg4-1.1.tgz b/pear/tests/pkg4-1.1.tgz Binary files differdeleted file mode 100644 index 08423ae28b..0000000000 --- a/pear/tests/pkg4-1.1.tgz +++ /dev/null diff --git a/pear/tests/pkg4AndAHalf-1.3.tgz b/pear/tests/pkg4AndAHalf-1.3.tgz Binary files differdeleted file mode 100644 index 57792b1bd5..0000000000 --- a/pear/tests/pkg4AndAHalf-1.3.tgz +++ /dev/null diff --git a/pear/tests/pkg5-1.1.tgz b/pear/tests/pkg5-1.1.tgz Binary files differdeleted file mode 100644 index 37d1b50a93..0000000000 --- a/pear/tests/pkg5-1.1.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-0.3.tgz b/pear/tests/stabilitytoolow-0.3.tgz Binary files differdeleted file mode 100644 index a7d6a86760..0000000000 --- a/pear/tests/stabilitytoolow-0.3.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-0.5.tgz b/pear/tests/stabilitytoolow-0.5.tgz Binary files differdeleted file mode 100644 index 28f88baec8..0000000000 --- a/pear/tests/stabilitytoolow-0.5.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-0.6beta.tgz b/pear/tests/stabilitytoolow-0.6beta.tgz Binary files differdeleted file mode 100644 index 05dc8f9a9e..0000000000 --- a/pear/tests/stabilitytoolow-0.6beta.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-1.0b1.tgz b/pear/tests/stabilitytoolow-1.0b1.tgz Binary files differdeleted file mode 100644 index 1aefb6b587..0000000000 --- a/pear/tests/stabilitytoolow-1.0b1.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-2.0a1.tgz b/pear/tests/stabilitytoolow-2.0a1.tgz Binary files differdeleted file mode 100644 index d0f89060ad..0000000000 --- a/pear/tests/stabilitytoolow-2.0a1.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-2.0b1.tgz b/pear/tests/stabilitytoolow-2.0b1.tgz Binary files differdeleted file mode 100644 index 890d2378dd..0000000000 --- a/pear/tests/stabilitytoolow-2.0b1.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-2.0dev.tgz b/pear/tests/stabilitytoolow-2.0dev.tgz Binary files differdeleted file mode 100644 index f5564ad8fa..0000000000 --- a/pear/tests/stabilitytoolow-2.0dev.tgz +++ /dev/null diff --git a/pear/tests/stabilitytoolow-3.0dev.tgz b/pear/tests/stabilitytoolow-3.0dev.tgz Binary files differdeleted file mode 100644 index 061164e340..0000000000 --- a/pear/tests/stabilitytoolow-3.0dev.tgz +++ /dev/null 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/testdownload.tgz b/pear/tests/testdownload.tgz Binary files differdeleted file mode 100644 index 0ddc3df361..0000000000 --- a/pear/tests/testdownload.tgz +++ /dev/null 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 c856afcf97..0000000000 --- a/pear/tests/user.input +++ /dev/null @@ -1 +0,0 @@ -a:0:{}
\ No newline at end of file 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 diff --git a/pear/tests/user3.input b/pear/tests/user3.input deleted file mode 100644 index e4ff5f4661..0000000000 --- a/pear/tests/user3.input +++ /dev/null @@ -1 +0,0 @@ -a:2:{s:7:"verbose";i:60;s:10:"__channels";a:2:{s:5:"test1";a:1:{s:7:"verbose";i:70;}s:5:"test2";a:1:{s:7:"verbose";i:71;}}}
\ No newline at end of file |