summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2004-05-29 09:09:46 +0000
committerGreg Beaver <cellog@php.net>2004-05-29 09:09:46 +0000
commit09ee88f9bf1f5b81c23f30a2829ec9755c9b8ac1 (patch)
tree1b0d8dfb5b8af5af8fd850158f82fd6c7f78d128 /pear
parent71e0c354ff79f6eb9a7a2302bf146e7cca484ce0 (diff)
downloadphp-git-09ee88f9bf1f5b81c23f30a2829ec9755c9b8ac1.tar.gz
modify php_dump.php, .cvsignore ignores *.php
move include to the place where it is used
Diffstat (limited to 'pear')
-rw-r--r--pear/tests/PEAR_test_mock_pearweb.php.inc1
-rw-r--r--pear/tests/pear_downloader_invalid.phpt1
-rw-r--r--pear/tests/php_dump.php.inc57
3 files changed, 58 insertions, 1 deletions
diff --git a/pear/tests/PEAR_test_mock_pearweb.php.inc b/pear/tests/PEAR_test_mock_pearweb.php.inc
index 9206a4d290..baff2cbe48 100644
--- a/pear/tests/PEAR_test_mock_pearweb.php.inc
+++ b/pear/tests/PEAR_test_mock_pearweb.php.inc
@@ -61,6 +61,7 @@ class PEAR_test_mock_pearweb {
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:
diff --git a/pear/tests/pear_downloader_invalid.phpt b/pear/tests/pear_downloader_invalid.phpt
index 22f61e92ad..c571708432 100644
--- a/pear/tests/pear_downloader_invalid.phpt
+++ b/pear/tests/pear_downloader_invalid.phpt
@@ -69,7 +69,6 @@ if (!empty($home)) {
}
require_once "PEAR/Downloader.php";
require_once 'PEAR/Installer.php';
-require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'php_dump.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc';
// no UI is needed for these tests
diff --git a/pear/tests/php_dump.php.inc b/pear/tests/php_dump.php.inc
new file mode 100644
index 0000000000..4f7a666295
--- /dev/null
+++ b/pear/tests/php_dump.php.inc
@@ -0,0 +1,57 @@
+<?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