diff options
Diffstat (limited to 'tests/php')
52 files changed, 0 insertions, 2269 deletions
diff --git a/tests/php/dbg.php b/tests/php/dbg.php deleted file mode 100644 index e626ce0..0000000 --- a/tests/php/dbg.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/** - * For debugging tests - * - */ - - - - - - - - -echo "\x1b[1;31m"; -(new ReflectionExtension('extension_for_tests') )->info(); -echo "\x1b[0m"; -echo "\x1b[0;34m"; -var_export( ini_get_all ( 'extension_for_tests' ) ); -echo "\x1b[0m", PHP_EOL; -exit; - -TestIniEntries\iniTest1(); - -//ini_set("extension_for_tests.some_string3", 'RFVBGT') ; -echo PHP_EOL; -echo "extension_for_tests.some_string ={{" , ini_get("extension_for_tests.some_string") , "}}", PHP_EOL; -echo "extension_for_tests.some_string2 ={{" , ini_get("extension_for_tests.some_string2") , "}}", PHP_EOL; -echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_string3") , "}}", PHP_EOL; -echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_bool") , "}}", PHP_EOL; - - -echo "\x1b[1;31m"; -(new ReflectionExtension('extension_for_tests') )->info(); -echo "\x1b[0m"; - -echo "\x1b[0;34m"; -var_export( ini_get_all ( 'extension_for_tests' ) ); -echo "\x1b[0m", PHP_EOL; - -ini_set("extension_for_tests.some_string3", 'RFVBGT') ; -echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_string3") , "}}", PHP_EOL; -ini_restore ( 'extension_for_tests.some_string3' ); -echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_string3") , "}}", PHP_EOL; - - -echo "extension_for_tests.some_bool :"; -var_dump(ini_get("extension_for_tests.some_bool")); -echo PHP_EOL; - -ini_set("extension_for_tests.some_bool", 'off'); - -echo "extension_for_tests.some_bool :"; -var_dump(ini_get("extension_for_tests.some_bool")); -echo PHP_EOL; - -//var_export(php_sapi_name()); diff --git a/tests/php/include/valueiterator/1.php b/tests/php/include/valueiterator/1.php deleted file mode 100644 index 984a77f..0000000 --- a/tests/php/include/valueiterator/1.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -class SimpleClass { - public $cl0_float = 3.14; - public $cl0_str1 = 'public str1'; - private $cl0_str2 = 'private str2'; - protected $cl0_str3 = 'protected str3'; -} - -class impIterator implements Iterator { - private $position = 0; - private $array = array( - "firstElement", - "secondElement", - "lastelEment", - ); - - public function __construct() { - $this->position = 0; - } - - function rewind() { - $this->position = 0; - } - - function current() { - return $this->array[$this->position]; - } - - function key() { - return 'key_' . $this->position; - } - - function next() { - ++$this->position; - } - - function valid() { - return isset($this->array[$this->position]); - } - - function __destruct() { - echo "~impIterator\n"; - } -} - -class impIterAggr1 implements IteratorAggregate { - public function getIterator() { - return new ArrayIterator(new SimpleClass); - } - function __destruct() { - echo "~impIterAggr1\n"; - } -} - -class impIterAggr2 implements IteratorAggregate { - public function getIterator() { - return new impIterator(); - } - function __destruct() { - echo "~impIterAggr2\n"; - } -} - - - - - - - - - - - - - diff --git a/tests/php/php_alias.sh b/tests/php/php_alias.sh deleted file mode 100755 index 4393172..0000000 --- a/tests/php/php_alias.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -#!/bin/bash -# -# this only alias to comand "/usr/bin/php -d enable_dl=On -d extension_dir=../ext_dir -d extension=extfortest.so" -# Designed to simplify debugging of tests -# You can get the same thing using normal aliases: `alias php_alias="php -d enable_dl=On -d extension_dir=../ext_dir -d extension=extfortest.so"` -# Exemlple toese: $ ./php_alias.sh dbg.php -# - -if [ ! $1 ] -then - echo "Required the path to php file" - exit; -fi - -LD_LIBRARY_PATH="$(cd $PWD/../.. && echo $PWD):${LD_LIBRARY_PATH}" -export LD_LIBRARY_PATH - -/usr/bin/php -d extension_dir=../ext_dir -d extension=extfortest.so -d ini7=47 -d ini1=ReValIni1 -d ini2=ReValIni2 $1 $2 $3 $4 $5 diff --git a/tests/php/phpt/.gitignore b/tests/php/phpt/.gitignore deleted file mode 100644 index b583a44..0000000 --- a/tests/php/phpt/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -*.diff -*.exp -*.log -*.out -*.php -*.sh -*.mem -*.phpt-diff -*.phpt-exp -*.phpt-log -*.phpt-out -*.phpt-php -*.phpt-sh -*.phpt-mem diff --git a/tests/php/phpt/class_obj/001.phpt b/tests/php/phpt/class_obj/001.phpt deleted file mode 100644 index b22a44c..0000000 --- a/tests/php/phpt/class_obj/001.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Test constructor & destructor ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -new TestBaseClass\MyClass(); - - -echo PHP_EOL; ---EXPECT-- -MyCustomClass::MyCustomClass() -MyCustomClass::~MyCustomClass
\ No newline at end of file diff --git a/tests/php/phpt/class_obj/002.phpt b/tests/php/phpt/class_obj/002.phpt deleted file mode 100644 index 847e602..0000000 --- a/tests/php/phpt/class_obj/002.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Test constructor & destructor ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -echo count(new TestBaseClass\MyClass($x)); - -echo PHP_EOL; ---EXPECT-- -MyCustomClass::MyCustomClass() -MyCustomClass::~MyCustomClass -33
\ No newline at end of file diff --git a/tests/php/phpt/class_obj/003-comparable.phpt b/tests/php/phpt/class_obj/003-comparable.phpt deleted file mode 100644 index 3e0b1f6..0000000 --- a/tests/php/phpt/class_obj/003-comparable.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test comparable objects ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -// initialize a couple of objects -$object1 = new TestBaseClass\Comparable(); -$object2 = new TestBaseClass\Comparable(); -$object3 = new TestBaseClass\Comparable(); - -// compare the objects -if ($object1 < $object2) -{ - echo("$object1 is smaller than $object2\n"); -} -else -{ - echo("$object1 is bigger than $object2\n"); -} - -if ($object1 == $object3) -{ - echo("$object1 is equal to $object3\n"); -} -else -{ - echo("$object1 is not equal to $object3\n"); -} - -if ($object1 != $object2) -{ - echo("$object1 is not equal to $object2\n"); -} -else -{ - echo("$object1 is equal to $object2\n"); -} - - -//echo PHP_EOL; ---EXPECT-- -Obj#1(2) is bigger than Obj#2(1) -Obj#1(2) is equal to Obj#3(2) -Obj#1(2) is not equal to Obj#2(1)
\ No newline at end of file diff --git a/tests/php/phpt/class_obj/004-static-funct.phpt b/tests/php/phpt/class_obj/004-static-funct.phpt deleted file mode 100644 index 8c78210..0000000 --- a/tests/php/phpt/class_obj/004-static-funct.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Test class with static function ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -// this will call PublicClass::staticMethod() -TestBaseClass\ClassWithStatic::static1(); - -// this will call PrivateClass::staticMethod() -TestBaseClass\ClassWithStatic::static2(); - -// this will call regularFunction() -TestBaseClass\ClassWithStatic::static3(); - -// this will also call PrivateClass::staticMethod() -TestBaseClass\staticFun1(); - - -//echo PHP_EOL; ---EXPECT-- -testStaticPubClass::staticMethod() -testStatic regular function -testStaticPrivClass::staticMethod() -testStaticPrivClass::staticMethod()
\ No newline at end of file diff --git a/tests/php/phpt/class_obj/005-static-prop.phpt b/tests/php/phpt/class_obj/005-static-prop.phpt deleted file mode 100644 index c0aa2ef..0000000 --- a/tests/php/phpt/class_obj/005-static-prop.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Test class with static property and class constant ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -var_dump( TestBaseClass\MyClass::CONSTANT1 ); -var_dump( TestBaseClass\MyClass::EXP ); -var_dump( TestBaseClass\MyClass::CONSTANT2 ); -var_dump( TestBaseClass\MyClass::CONSTANT3 ); - -var_dump( TestBaseClass\MyClass::$StatProp1 ); -var_dump( TestBaseClass\MyClass::$Exp ); -var_dump( TestBaseClass\MyClass::$StatProp2 ); -var_dump( TestBaseClass\MyClass::$StatProp3 ); -TestBaseClass\MyClass::$StatProp2 = "otherval"; -var_dump( TestBaseClass\MyClass::$StatProp2 ); - - -//echo PHP_EOL; ---EXPECT-- -string(11) "some string" -float(2.718281828459) -int(-2582341) -bool(true) -string(11) "some string" -float(2.718281828459) -int(-2582341) -bool(true) -string(8) "otherval"
\ No newline at end of file diff --git a/tests/php/phpt/class_obj/readme b/tests/php/phpt/class_obj/readme deleted file mode 100644 index 6c89a94..0000000 --- a/tests/php/phpt/class_obj/readme +++ /dev/null @@ -1 +0,0 @@ -tests iterator diff --git a/tests/php/phpt/ini_entries/001.phpt b/tests/php/phpt/ini_entries/001.phpt deleted file mode 100644 index e85af06..0000000 --- a/tests/php/phpt/ini_entries/001.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Test ini entries #1 ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---INI-- -ini2=ReValIni2 ---FILEEOF-- -<?php - -TestIniEntries\iniTest1(); - ---EXPECT-- -ini_get(ini1) = valIni1 -ini_get(ini2) = ReValIni2 -ini_get(ini3) = valIni3 -ini_get(ini4) = On -ini_get(ini5) = Off -ini_get(ini6) = 55 -ini6val = 55
\ No newline at end of file diff --git a/tests/php/phpt/ini_entries/002.phpt b/tests/php/phpt/ini_entries/002.phpt deleted file mode 100644 index 04b1b46..0000000 --- a/tests/php/phpt/ini_entries/002.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -Test ini entries #2 ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---INI-- -ini2=ReValIni2 -ini6=33 ---FILEEOF-- -<?php - -var_export( ini_get_all ( 'extension_for_tests' ) ); - ---EXPECT-- -array ( - 'ini1' => - array ( - 'global_value' => 'valIni1', - 'local_value' => 'valIni1', - 'access' => 7, - ), - 'ini2' => - array ( - 'global_value' => 'OrigValIni2', - 'local_value' => 'ReValIni2', - 'access' => 7, - ), - 'ini3' => - array ( - 'global_value' => 'OrigValIni3', - 'local_value' => 'valIni3', - 'access' => 4, - ), - 'ini4' => - array ( - 'global_value' => 'Off', - 'local_value' => 'On', - 'access' => 1, - ), - 'ini5' => - array ( - 'global_value' => 'Off', - 'local_value' => 'Off', - 'access' => 7, - ), - 'ini6' => - array ( - 'global_value' => '11', - 'local_value' => '33', - 'access' => 7, - ), - 'ini7' => - array ( - 'global_value' => '5', - 'local_value' => '74', - 'access' => 7, - ), - 'ini8' => - array ( - 'global_value' => '6.283185', - 'local_value' => '3.141593', - 'access' => 7, - ), - 'ini9' => - array ( - 'global_value' => '5.436564', - 'local_value' => '2.718282', - 'access' => 1, - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/ini_entries/003.phpt b/tests/php/phpt/ini_entries/003.phpt deleted file mode 100644 index 5ad6efb..0000000 --- a/tests/php/phpt/ini_entries/003.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Test ini entries #3 ---DESCRIPTION-- -Test to check palce action of ini entries ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -echo ini_get('ini2'), PHP_EOL; -echo ini_get('ini3'), PHP_EOL; -ini_set('ini2', 'newIni2'); -ini_set('ini3', 'newIni3'); -echo ini_get('ini2'), PHP_EOL; -echo ini_get('ini3'), PHP_EOL; -ini_restore('ini2'); -ini_restore('ini3'); -echo ini_get('ini2'), PHP_EOL; -echo ini_get('ini3'); - ---EXPECT-- -valIni2 -valIni3 -newIni2 -valIni3 -valIni2 -valIni3
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/001.phpt b/tests/php/phpt/valueiterator/001.phpt deleted file mode 100644 index af75ce6..0000000 --- a/tests/php/phpt/valueiterator/001.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Iterate array ---DESCRIPTION-- -Iterate regular php array ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php -require dirname(__FILE__) . '/../../include/valueiterator/1.php'; - -$arr = array('qwe' => 'qweqweqweqw',5,'asd' => '«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰»', 'zxccvx' => 'sdfsecvyh6bug6yfty',); - -TestValueIterator\loopValue($arr); - -echo PHP_EOL; ---EXPECT-- -Array/Object contains 4 items -[qwe]=qweqweqweqw -[0]=5 -[asd]=«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰» -[zxccvx]=sdfsecvyh6bug6yfty
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/002.phpt b/tests/php/phpt/valueiterator/002.phpt deleted file mode 100644 index fdffdf7..0000000 --- a/tests/php/phpt/valueiterator/002.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Iterate object of stdClass ---DESCRIPTION-- -Iterate object of stdClass ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php -require dirname(__FILE__) . '/../../include/valueiterator/1.php'; - -$arr = array('qwe' => 'qweqweqweqw',5,'asd' => '«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰»', 'zxccvx' => 'sdfsecvyh6bug6yfty',); -$obj = (object)$arr; - -TestValueIterator\loopValue($obj); - -echo PHP_EOL; ---EXPECT-- -Array/Object contains 0 items -[qwe]=qweqweqweqw -[0]=5 -[asd]=«£¥§©®°±¶⅐⅒⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰» -[zxccvx]=sdfsecvyh6bug6yfty
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/003.phpt b/tests/php/phpt/valueiterator/003.phpt deleted file mode 100644 index d29d7e5..0000000 --- a/tests/php/phpt/valueiterator/003.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Iterate object ---DESCRIPTION-- -Iterate regular php object ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php -require dirname(__FILE__) . '/../../include/valueiterator/1.php'; - -$smpl = new SimpleClass; - -TestValueIterator\loopValue($smpl); - ---EXPECT-- -Array/Object contains 0 items -[cl0_float]=3.14 -[cl0_str1]=public str1
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/004.phpt b/tests/php/phpt/valueiterator/004.phpt deleted file mode 100644 index 432b500..0000000 --- a/tests/php/phpt/valueiterator/004.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Iterate itarable oblect ---DESCRIPTION-- -class impIterator implements Iterator ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php -require dirname(__FILE__) . '/../../include/valueiterator/1.php'; - -$it = new impIterator; - -TestValueIterator\loopValue($it); - ---EXPECT-- -Array/Object contains 0 items -[key_0]=firstElement -[key_1]=secondElement -[key_2]=lastelEment -~impIterator
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/005.phpt b/tests/php/phpt/valueiterator/005.phpt deleted file mode 100644 index f86845e..0000000 --- a/tests/php/phpt/valueiterator/005.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Iterate itarable oblect ---DESCRIPTION-- -class impIterAggr1 implements IteratorAggregate ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php -require dirname(__FILE__) . '/../../include/valueiterator/1.php'; - -$iag1 = new impIterAggr1; - -TestValueIterator\loopValue($iag1); - ---EXPECT-- -Array/Object contains 0 items -[cl0_float]=3.14 -[cl0_str1]=public str1 -~impIterAggr1
\ No newline at end of file diff --git a/tests/php/phpt/valueiterator/006.phpt b/tests/php/phpt/valueiterator/006.phpt deleted file mode 100644 index ea97c2b..0000000 --- a/tests/php/phpt/valueiterator/006.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Iterate itarable oblect ---DESCRIPTION-- -class impIterAggr1 implements IteratorAggregate ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php -require dirname(__FILE__) . '/../../include/valueiterator/1.php'; - -$iag2 = new impIterAggr2; - -TestValueIterator\loopValue($iag2); - ---EXPECT-- -Array/Object contains 0 items -[key_0]=firstElement -[key_1]=secondElement -[key_2]=lastelEment -~impIterator -~impIterAggr2 diff --git a/tests/php/phpt/valueiterator/007-Iterate-internal-array.phpt b/tests/php/phpt/valueiterator/007-Iterate-internal-array.phpt deleted file mode 100644 index 1f18203..0000000 --- a/tests/php/phpt/valueiterator/007-Iterate-internal-array.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Iterate internal array ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -TestValueIterator\loopArray(); - ---EXPECT-- -Array/Object contains 4 items -[0]=val0 -[1]=val1 -[third]=val3 -[fourth]=val3 diff --git a/tests/php/phpt/valueiterator/readme b/tests/php/phpt/valueiterator/readme deleted file mode 100644 index 0156308..0000000 --- a/tests/php/phpt/valueiterator/readme +++ /dev/null @@ -1 +0,0 @@ -Tests of basic capabilities diff --git a/tests/php/phpt/variables/001-process_globals.phpt b/tests/php/phpt/variables/001-process_globals.phpt deleted file mode 100644 index 022e99c..0000000 --- a/tests/php/phpt/variables/001-process_globals.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -Global variables in PHP-CPP ---DESCRIPTION-- -The author of the original: Jasper van Eck<jasper.vaneck@copernica.com> ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -// we first need to set a number of globals -$b = 10; -$d = function($a,$b,$c) { - return $a+$b+$c; -}; - -// fun global var -$e = array( - function($a) { - return $a; - } -); - - -// call the C++ function that will do something -$d = TestVariables\process_globals(); - -// the global variable $a should not have the value 1 -echo("a = $a\n"); - -// the variable $b should not be 11 -echo("b = $b\n"); - -// $c should be an array with value 200 -echo("c['member'] = ".$c['member']."\n"); - -// $d is overwritten and now is 6 -echo("d = $d\n"); - -// e should be replaced by a string -echo("e = $e\n"); - ---EXPECT-- -a = 1 -b = 11 -c['member'] = 200 -d = 6 -e = hello
\ No newline at end of file diff --git a/tests/php/phpt/variables/002-get_complex_array.phpt b/tests/php/phpt/variables/002-get_complex_array.phpt deleted file mode 100644 index 716fda9..0000000 --- a/tests/php/phpt/variables/002-get_complex_array.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -get_complex_array ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -/* -function get_complex_array() -{ - return array( - "a" => 123, - "b" => 456, - "c" => array("nested value","example",7) - ); -} -var_export(get_complex_array()); -*/ -var_export(TestVariables\get_complex_array()); - - -echo PHP_EOL; ---EXPECT-- -array ( - 'a' => 123, - 'b' => 456, - 'c' => - array ( - 0 => 'nested value', - 1 => 'example', - 2 => 7, - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/003-value-types.phpt b/tests/php/phpt/variables/003-value-types.phpt deleted file mode 100644 index 477fbe2..0000000 --- a/tests/php/phpt/variables/003-value-types.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -get_complex_array ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -# check Callable: http://php.net/manual/en/function.is-callable.php -function ret5() {return 5;} -class someClass { - function someMethod() {return 5;} -} -class CallableClass { - public function __invoke(){} -} - -$anObject = new someClass(); -$methodVariable = array($anObject, 'someMethod'); - - -# check array -$arr = array( - 'Null' => NULL, - 'Numeric' => 2014, - 'Float' => 3.14, - 'Bool' => true, - 'Array' => array(5,'a' => 33, 'str'), - 'Object' => new stdClass(), - 'String' => 'String', - 'Resource' => 7, - 'Constant' => 5, - 'ConstantArray' => 11, - 'Callable1' => 'ret5', - 'Callable2' => $methodVariable, - 'Callable3' => function () {return 5;}, - 'Callable4' => new CallableClass() -); - -TestVariables\value_types($arr); - -//To check uncomment the following lines: -/* -echo "\n\nCallable1:"; -var_export(is_callable($arr['Callable1'])); -echo PHP_EOL,'Callable2:'; -var_export(is_callable($arr['Callable2'])); -echo PHP_EOL,'Callable3:'; -var_export(is_callable($arr['Callable3'])); -echo PHP_EOL,'Callable4:'; -var_export(is_callable($arr['Callable4'])); -echo PHP_EOL,'No Callable:'; -var_export(is_callable(new stdClass)); -*/ - - -echo PHP_EOL; ---EXPECT-- -Null: Yes -Numeric: Yes -Float: Yes -Bool: Yes -Array: Yes -Object: Yes -String: Yes -Resource: No -Constant: No -ConstantArray: No -Callable1: Yes -Callable2: Yes -Callable3: Yes -Callable4: Yes
\ No newline at end of file diff --git a/tests/php/phpt/variables/004-store-scalar-variables.phpt b/tests/php/phpt/variables/004-store-scalar-variables.phpt deleted file mode 100644 index 53cc681..0000000 --- a/tests/php/phpt/variables/004-store-scalar-variables.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -Test variables defined in PHP-CPP ---DESCRIPTION-- -in PHP-CPP: -Php::Value scalar_store(void) { - - Php::Value value1 = 1234; - Php::Value value2 = "this is a string"; - Php::Value value3 = std::string("another string"); - Php::Value value4 = nullptr; - Php::Value value5 = 123.45; - Php::Value value6 = true; - - Php::Value r; - r[0] = value1; - r[1] = value2; - r[2] = value3; - r[3] = value4; - r[4] = value5; - r[5] = value6; - - r[6] = 1234; - r[7] = "this is a string"; - r[8] = std::string("another string"); - r[9] = nullptr; // NULL - r[10] = Php::Value(); // NULL - r[11] = 123.45; - r[12] = false; - - return r; -} - ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -var_export(TestVariables\scalar_store()); - - -//echo PHP_EOL; ---EXPECT-- -array ( - 0 => 1234, - 1 => 'this is a string', - 2 => 'another string', - 3 => NULL, - 4 => 123.45, - 5 => true, - 6 => 1234, - 7 => 'this is a string', - 8 => 'another string', - 9 => NULL, - 10 => NULL, - 11 => 123.45, - 12 => false, -) diff --git a/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt b/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt deleted file mode 100644 index 9de9ba5..0000000 --- a/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -cast objects to scalars ---DESCRIPTION-- -http://www.phpcpp.com/documentation/special-features#casting-functions ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -function bool2str($b) { - return $b ? "Yes" : "No"; -} -$obj = new TestVariables\Obj2Scalar(); -echo " long: ", (int)$obj, "\n string: ", (string)$obj, "\n double: ", (double)$obj, "\n bool: ", bool2str((bool)$obj); - - ---EXPECT-- - long: 27032014 - string: Mount Meru, also called Sumeru (Sanskrit) - double: 3.14159265359 - bool: Yes diff --git a/tests/php/phpt/variables/006-casting-obj2str.phpt b/tests/php/phpt/variables/006-casting-obj2str.phpt deleted file mode 100644 index 53d9707..0000000 --- a/tests/php/phpt/variables/006-casting-obj2str.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -Test Php::Value casting operators (object to string) ---DESCRIPTION-- - -Converting a php object to a string - - ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -function native_value_casting($value) { - echo (string)$value, PHP_EOL; -} -class TestClass -{ - public function __toString() {return "I am TestClass";} -} - -TestVariables\value_cast2str(new TestClass()); -//native_value_casting(new TestClass()); - -TestVariables\value_cast2str("some string"); - - - ---EXPECT-- -I am TestClass -some string
\ No newline at end of file diff --git a/tests/php/phpt/variables/007-overloaded-operators.phpt b/tests/php/phpt/variables/007-overloaded-operators.phpt deleted file mode 100644 index a26b1a4..0000000 --- a/tests/php/phpt/variables/007-overloaded-operators.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test Php::Value overloaded operators ---DESCRIPTION-- - -Many different operators are overloaded too so that you can use a Php::Value object directly in arithmetric operations, -compare it with other variables, or send it to an output stream. - - ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -TestVariables\overloaded_op(5); -TestVariables\overloaded_op(3.14); -TestVariables\overloaded_op(12); -TestVariables\overloaded_op(120); -TestVariables\overloaded_op(-1000); -TestVariables\overloaded_op("some string"); - - - ---EXPECT-- -15 -7 -1851.75 -0.121507 -13.14 -5 -1622.13 -0.10644 -value == 12 -22 -14 -2715.9 -0.17821 -value > 100 -130 -122 -16048.5 -1.05306 --990 --998 --122216 --8.01944 -value == 'some string' -10 -2 -1234.5 -0.0810045
\ No newline at end of file diff --git a/tests/php/phpt/variables/008-value-arrays.phpt b/tests/php/phpt/variables/008-value-arrays.phpt deleted file mode 100644 index 6950780..0000000 --- a/tests/php/phpt/variables/008-value-arrays.phpt +++ /dev/null @@ -1,89 +0,0 @@ ---TEST-- -Test Php::Value arrays ---DESCRIPTION-- ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -$r = TestVariables\value_arrays(); - - // To check: -/* - $array; - $array[0] = "apple"; - $array[1] = "banana"; - $array[2] = "tomato"; - - // an initializer list can be used to create a filled array - $filled = ["a", "b", "c", "d"]; - - // create an associative array - $assoc["apple"] = "green"; - $assoc["banana"] = "yellow"; - $assoc["tomato"] = "green"; - - // the variables in an array do not all have to be of the same type - $assoc2["x"] = "info@example.com"; - $assoc2["y"] = NULL; - $assoc2["z"] = 123; - - // nested arrays are possible too - $assoc3["x"] = "info@example.com"; - $assoc3["y"] = NULL; - $assoc3["z"][0] = "a"; - $assoc3["z"][1] = "b"; - $assoc3["z"][2] = "c"; - - $r = []; - $r["array"] = $array; - $r["filled"] = $filled; - $r["assoc"] = $assoc; - $r["assoc2"] = $assoc2; - $r["assoc3"] = $assoc3; -*/ - -var_export($r); - - - ---EXPECT-- -array ( - 'array' => - array ( - 0 => 'apple', - 1 => 'banana', - 2 => 'tomato', - ), - 'filled' => - array ( - 0 => 'a', - 1 => 'b', - 2 => 'c', - 3 => 'd', - ), - 'assoc' => - array ( - 'apple' => 'green', - 'banana' => 'yellow', - 'tomato' => 'green', - ), - 'assoc2' => - array ( - 'x' => 'info@example.com', - 'y' => NULL, - 'z' => 123, - ), - 'assoc3' => - array ( - 'x' => 'info@example.com', - 'y' => NULL, - 'z' => - array ( - 0 => 'a', - 1 => 'b', - 2 => 'c', - ), - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/009-value-object.phpt b/tests/php/phpt/variables/009-value-object.phpt deleted file mode 100644 index c45cae8..0000000 --- a/tests/php/phpt/variables/009-value-object.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Test Php::Value object #1 ---DESCRIPTION-- - create empty object of type stdClass - object properties can be accessed with square brackets ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -$object = TestVariables\value_object1(); - -//$object = (object)array("property1" => "value1", "property2" => "value2"); - -var_export($object); - - - ---EXPECT-- -stdClass::__set_state(array( - 'property1' => 'value1', - 'property2' => 'value2', -))
\ No newline at end of file diff --git a/tests/php/phpt/variables/010-value-object2.phpt b/tests/php/phpt/variables/010-value-object2.phpt deleted file mode 100644 index 8697a69..0000000 --- a/tests/php/phpt/variables/010-value-object2.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Test Php::Value object #2 ---DESCRIPTION-- - create empty object of type stdClass - object properties can be accessed with square brackets ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -//date_default_timezone_set('Europe/Amsterdam'); -var_export(TestVariables\value_object2()); - - ---EXPECT-- -2014-03-27 00:37:15 -2016-03-31 15:48:00 -7200 -DateTime::__set_state(array( - 'date' => '2014-03-27 00:37:15', - 'timezone_type' => 3, - 'timezone' => 'Europe/Amsterdam', -))
\ No newline at end of file diff --git a/tests/php/phpt/variables/011-value-casting-operators.phpt b/tests/php/phpt/variables/011-value-casting-operators.phpt deleted file mode 100644 index 27e92c7..0000000 --- a/tests/php/phpt/variables/011-value-casting-operators.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -Test Php::Value casting operators (64bit OS only) ---DESCRIPTION-- -The Php::Value class has casting operators to cast the object to almost every thinkable native type. - -native_value_casting - repeats the behavior of c++ functions TestVariables\value_casting -the output of each of these functions should be the same - -Skip if the current OS is not 64-bit architecture. - ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests") || 'x86_64' != php_uname('m') ) print "skip"; ?> ---FILEEOF-- -<?php - - -function bool2str($b) { - return $b ? "Yes" : "No"; -} -function native_value_casting($value) { - //echo " long:", (int)$value, "\n string:", (string)$value, "\n double:", (double)$value, "\n bool:", bool2str((bool)$value), PHP_EOL; - echo " long:", (int)$value, "\n string:", (string)$value, "\n bool:", bool2str((bool)$value), PHP_EOL; -} - - -function out($v) { - echo 'Test '; - var_export($v); - echo ':', PHP_EOL; - TestVariables\value_casting($v); - //native_value_casting($v); - echo PHP_EOL; -} - -out(5555555555555555); -out("9223372036854775807"); -out(9223372036854775807); -out(5); -out(-99999999); -out("18"); -out("3.14159265359"); -out(3.14159265359); -out(25/7); -out(" this is a string "); -out(" 2-nd string "); -out("false"); -out(false); -out("true"); -out(true); -out(0); -out("0"); -out(0123); // octal number (equivalent to 83 decimal) -out(0x1A); // hexadecimal number (equivalent to 26 decimal) - - - - -//echo PHP_EOL; ---EXPECT-- -Test 5555555555555555: - long:5555555555555555 - string:5555555555555555 - bool:Yes - -Test '9223372036854775807': - long:9223372036854775807 - string:9223372036854775807 - bool:Yes - -Test 9223372036854775807: - long:9223372036854775807 - string:9223372036854775807 - bool:Yes - -Test 5: - long:5 - string:5 - bool:Yes - -Test -99999999: - long:-99999999 - string:-99999999 - bool:Yes - -Test '18': - long:18 - string:18 - bool:Yes - -Test '3.14159265359': - long:3 - string:3.14159265359 - bool:Yes - -Test 3.14159265359: - long:3 - string:3.14159265359 - bool:Yes - -Test 3.5714285714286: - long:3 - string:3.5714285714286 - bool:Yes - -Test ' this is a string ': - long:0 - string: this is a string - bool:Yes - -Test ' 2-nd string ': - long:2 - string: 2-nd string - bool:Yes - -Test 'false': - long:0 - string:false - bool:Yes - -Test false: - long:0 - string: - bool:No - -Test 'true': - long:0 - string:true - bool:Yes - -Test true: - long:1 - string:1 - bool:Yes - -Test 0: - long:0 - string:0 - bool:No - -Test '0': - long:0 - string:0 - bool:No - -Test 83: - long:83 - string:83 - bool:Yes - -Test 26: - long:26 - string:26 - bool:Yes
\ No newline at end of file diff --git a/tests/php/phpt/variables/012-value-casting-operators-double.phpt b/tests/php/phpt/variables/012-value-casting-operators-double.phpt deleted file mode 100644 index babd476..0000000 --- a/tests/php/phpt/variables/012-value-casting-operators-double.phpt +++ /dev/null @@ -1,80 +0,0 @@ ---TEST-- -Test Php::Value casting operators (double) ---DESCRIPTION-- -The Php::Value class has casting operators to cast the object to almost every thinkable native type. - -native_value_casting - repeats the behavior of c++ functions TestVariables\value_casting -the output of each of these functions should be the same ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - - -function out($v) { - echo 'Test '; - var_export($v); - echo ':', PHP_EOL; - TestVariables\value_cast2double($v); - //echo (double)$v, PHP_EOL;; - //echo PHP_EOL; -} - -out(5555555555555); -out("999999999999999"); -out(99999999999999); -out(5); -out(-99999999); -out("18"); -out("3.14159265359"); -out(3.14159265359); -out(" this is a string "); -out(" 2-nd string "); -out("false"); -out(false); -out("true"); -out(true); -out(0); -out("0"); -out(0123); // octal number (equivalent to 83 decimal) -out(0x1A); // hexadecimal number (equivalent to 26 decimal) - - ---EXPECT-- -Test 5555555555555: -5555555555555 -Test '999999999999999': -999999999999999 -Test 99999999999999: -99999999999999 -Test 5: -5 -Test -99999999: --99999999 -Test '18': -18 -Test '3.14159265359': -3.14159265359 -Test 3.14159265359: -3.14159265359 -Test ' this is a string ': -0 -Test ' 2-nd string ': -2 -Test 'false': -0 -Test false: -0 -Test 'true': -0 -Test true: -1 -Test 0: -0 -Test '0': -0 -Test 83: -83 -Test 26: -26
\ No newline at end of file diff --git a/tests/php/phpt/variables/013-calling-php-functions.phpt b/tests/php/phpt/variables/013-calling-php-functions.phpt deleted file mode 100644 index 5ec6644..0000000 --- a/tests/php/phpt/variables/013-calling-php-functions.phpt +++ /dev/null @@ -1,113 +0,0 @@ ---TEST-- -calling-php-functions from userspace ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - - -function some_function($param) { - echo("userspace function called with parameters:\n"); - var_export(func_get_args ()); -} - -TestVariables\fnFromUserSpace(); - - - ---EXPECT-- -fnFromUserSpace -userspace function called with parameters: -array ( - 0 => 'param1', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), - 5 => - DateTime::__set_state(array( - 'date' => '2014-03-28 19:42:15', - 'timezone_type' => 3, - 'timezone' => 'Asia/Yekaterinburg', - )), -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', -)userspace function called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', - 9 => 'param10', -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/014-calling-php-functions.phpt b/tests/php/phpt/variables/014-calling-php-functions.phpt deleted file mode 100644 index 4a05e2a..0000000 --- a/tests/php/phpt/variables/014-calling-php-functions.phpt +++ /dev/null @@ -1,113 +0,0 @@ ---TEST-- -calling-php-Callback-functions ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - - -function some_function($param) { - echo("Callback called with parameters:\n"); - var_export(func_get_args ()); -} - -TestVariables\fnCallback("some_function"); - - - ---EXPECT-- -call callback -Callback called with parameters: -array ( - 0 => 'param1', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), - 5 => - DateTime::__set_state(array( - 'date' => '2014-03-28 19:42:15', - 'timezone_type' => 3, - 'timezone' => 'Asia/Yekaterinburg', - )), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', - 9 => 'param10', -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/015-calling-php-functions.phpt b/tests/php/phpt/variables/015-calling-php-functions.phpt deleted file mode 100644 index e9382b2..0000000 --- a/tests/php/phpt/variables/015-calling-php-functions.phpt +++ /dev/null @@ -1,109 +0,0 @@ ---TEST-- -calling-php-Callback-functions (lambda) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -TestVariables\fnCallback( function($param) { - echo("Callback called with parameters:\n"); - var_export(func_get_args ()); -}); - - ---EXPECT-- -call callback -Callback called with parameters: -array ( - 0 => 'param1', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), - 5 => - DateTime::__set_state(array( - 'date' => '2014-03-28 19:42:15', - 'timezone_type' => 3, - 'timezone' => 'Asia/Yekaterinburg', - )), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', - 9 => 'param10', -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/016-calling-php-functions.phpt b/tests/php/phpt/variables/016-calling-php-functions.phpt deleted file mode 100644 index 46fda6e..0000000 --- a/tests/php/phpt/variables/016-calling-php-functions.phpt +++ /dev/null @@ -1,113 +0,0 @@ ---TEST-- -calling-php-Callback-functions (__invoke) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -class CallableClass { - public function __invoke() { - echo("Callback called with parameters:\n"); - var_export(func_get_args ()); - } -} - -TestVariables\fnCallback(new CallableClass()); - - ---EXPECT-- -call callback -Callback called with parameters: -array ( - 0 => 'param1', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), - 5 => - DateTime::__set_state(array( - 'date' => '2014-03-28 19:42:15', - 'timezone_type' => 3, - 'timezone' => 'Asia/Yekaterinburg', - )), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', - 9 => 'param10', -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/017-calling-php-functions.phpt b/tests/php/phpt/variables/017-calling-php-functions.phpt deleted file mode 100644 index 630399a..0000000 --- a/tests/php/phpt/variables/017-calling-php-functions.phpt +++ /dev/null @@ -1,115 +0,0 @@ ---TEST-- -calling-php-Callback-functions (method of class) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -class someClass { - function someMethod() { - echo("Callback called with parameters:\n"); - var_export(func_get_args ()); - } -} - -$anObject = new someClass(); -$methodVariable = array($anObject, 'someMethod'); -TestVariables\fnCallback($methodVariable); - - ---EXPECT-- -call callback -Callback called with parameters: -array ( - 0 => 'param1', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => - array ( - 0 => 'param5', - 1 => 3.14159265359, - 2 => 28032014, - 'key' => 'value', - ), - 5 => - DateTime::__set_state(array( - 'date' => '2014-03-28 19:42:15', - 'timezone_type' => 3, - 'timezone' => 'Asia/Yekaterinburg', - )), -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', -)Callback called with parameters: -array ( - 0 => 'param1', - 1 => 'param2', - 2 => 'param3', - 3 => 'param4', - 4 => 'param5', - 5 => 'param6', - 6 => 'param7', - 7 => 'param8', - 8 => 'param9', - 9 => 'param10', -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/018-calling-php-functions.phpt b/tests/php/phpt/variables/018-calling-php-functions.phpt deleted file mode 100644 index 1b8bfeb..0000000 --- a/tests/php/phpt/variables/018-calling-php-functions.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -calling-php-callable ---DESCRIPTION-- -call callable object of class from user space -call method of class from user space ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - - -class CallableClass { - public function __construct($a){ $this->a = $a;} - public function __invoke($b){ echo "CallableClass({$this->a})::__invoke($b)";} - private $a = ""; -} - -class usrspClass { - function __construct($a){ $this->a = $a;} - function someMethod($b) {echo "usrspClass({$this->a})::someMethod($b)";} - private $a = ""; -} - - -TestVariables\fnFromUserSpace2(); - - ---EXPECT-- -2014-03-28 21:22:15 -2014-03-28 21:22:15 -usrspClass(Mount Meru)::someMethod(is in the Arctics) -CallableClass(Arctics around mount Meru)::__invoke(is the birthplace of the Hyperboreans)
\ No newline at end of file diff --git a/tests/php/phpt/variables/019-HashMember-1.phpt b/tests/php/phpt/variables/019-HashMember-1.phpt deleted file mode 100644 index ebc126f..0000000 --- a/tests/php/phpt/variables/019-HashMember-1.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -get_complex_array (test HashMember #1) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -/* -$r = array(); -$r["key1"] = array(); -$r["key1"]["key2"] = "val2"; -$r["key1"]["key3"] = "val3"; -var_export($r);echo "\n"; -*/ - -var_export(TestVariables\test_HashMember_1()); - - -echo PHP_EOL; ---EXPECT-- -array ( - 'key1' => - array ( - 'key2' => 'val2', - 'key3' => 'val3', - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/020-HashMember-2.phpt b/tests/php/phpt/variables/020-HashMember-2.phpt deleted file mode 100644 index bb48d06..0000000 --- a/tests/php/phpt/variables/020-HashMember-2.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -get_complex_array (test HashMember #2) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -/* -$r = array(); -$r["k1"]["k3"] = "v1"; -$r["k1"]["k2"]["k4"] = "v2"; -$r["k5"][1] = "v3"; -$r[2]["k6"][1] = "v4"; -$r[3][4][1] = "v5"; -$r[3][4][2][5][7][11] = "v5"; -$r[3][4][2][5][7]["k"] = "v5"; -$r["c"][0] = "nested value"; -$r["c"][1] = NULL; -$r["c"][2] = array(); -$r["c"][3] = "example"; -var_export($r);echo "\n"; -*/ - -var_export(TestVariables\test_HashMember_2()); - - -echo PHP_EOL; ---EXPECT-- -array ( - 'k1' => - array ( - 'k3' => 'v1', - 'k2' => - array ( - 'k4' => 'v2', - ), - ), - 'k5' => - array ( - 1 => 'v3', - ), - 2 => - array ( - 'k6' => - array ( - 1 => 'v4', - ), - ), - 3 => - array ( - 4 => - array ( - 1 => 'v5', - 2 => - array ( - 5 => - array ( - 7 => - array ( - 11 => 'v5', - 'k' => 'v5', - ), - ), - ), - ), - ), - 'c' => - array ( - 0 => 'nested value', - 1 => NULL, - 2 => - array ( - ), - 3 => 'example', - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/021-HashMember-3.phpt b/tests/php/phpt/variables/021-HashMember-3.phpt deleted file mode 100644 index 20f43ba..0000000 --- a/tests/php/phpt/variables/021-HashMember-3.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -get_complex_array (test HashMember #3) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -/* -$r = array(); -$r["key1"] = array(); -$r["key1"]["key2"] = "val1-2"; -$r["key1"]["key3"] = "val1-3"; -var_export($r);echo "\n"; -*/ - -var_export(TestVariables\test_HashMember_3()); - - -echo PHP_EOL; ---EXPECT-- -array ( - 'key1' => - array ( - 'key2' => 'val1-2', - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/022-HashMember-4.phpt b/tests/php/phpt/variables/022-HashMember-4.phpt deleted file mode 100644 index cbdc8b0..0000000 --- a/tests/php/phpt/variables/022-HashMember-4.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -get_complex_array (test HashMember #4) ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -var_export(TestVariables\test_HashMember_4()); - - -echo PHP_EOL; ---EXPECT-- -array ( - 0 => - array ( - 'key1' => - array ( - 'key2' => - array ( - 'key3' => 'val', - ), - ), - ), - 1 => - array ( - 'str1' => 'example', - 'str2' => 'example', - ), - 2 => - array ( - 'str1' => - array ( - 'str2' => 'val1-2', - 'str3' => 'val1-3', - ), - ), -)
\ No newline at end of file diff --git a/tests/php/phpt/variables/023-cookie.phpt b/tests/php/phpt/variables/023-cookie.phpt deleted file mode 100644 index 0648188..0000000 --- a/tests/php/phpt/variables/023-cookie.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -test cookie ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---COOKIE-- -peace=toTheWorld;freedom=toThePeople ---FILEEOF-- -<?php - - -TestVariables\getCookie(); - ---EXPECT-- -_COOKIE[peace] = toTheWorld -_COOKIE[freedom] = toThePeople -_COOKIE[empty] =
\ No newline at end of file diff --git a/tests/php/phpt/variables/024-get-post.phpt b/tests/php/phpt/variables/024-get-post.phpt deleted file mode 100644 index 9ac1243..0000000 --- a/tests/php/phpt/variables/024-get-post.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -test get and post ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---GET-- -a=<b>test</b>&b=http://phpcpp.com&ar[elm1]=1234&ar[elm2]=0660&a=0234 ---POST-- -c=<p>string</p>&d=12345.7&e[]=e1&e[]=e2 ---FILEEOF-- -<?php - - -TestVariables\get_post(); - ---EXPECTF-- -_GET[a] = 0234 -_GET[b] = http://phpcpp.com -_GET[ar][elm1] = 1234 -_GET[ar][elm2] = 0660 -_POST[c] = <p>string</p> -_POST[d] = 12345.7 - -Notice: Array to string conversion in %s/024-get-post.php on line %d -_POST[e] = Array -_POST[e][0] = e1 -_POST[e][1] = e2
\ No newline at end of file diff --git a/tests/php/phpt/variables/025-post-raw1.phpt b/tests/php/phpt/variables/025-post-raw1.phpt deleted file mode 100644 index 76fed0f..0000000 --- a/tests/php/phpt/variables/025-post-raw1.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -test post raw #1 ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---POST_RAW-- -Content-type: multipart/form-data, boundary=AaB03x - ---AaB03x -content-disposition: form-data; name="username" - -valmat ---AaB03x -content-disposition: form-data; name="text" - -Hellow World! ---AaB03x ---FILEEOF-- -<?php - - -TestVariables\post_raw1(); - -//foreach($_POST as $k => $v) {echo "\n$k => $v";} - ---EXPECTF-- -username => valmat -text => Hellow World!
\ No newline at end of file diff --git a/tests/php/phpt/variables/026-post-raw2.phpt b/tests/php/phpt/variables/026-post-raw2.phpt deleted file mode 100644 index 4bee44c..0000000 --- a/tests/php/phpt/variables/026-post-raw2.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Post files ---DESCRIPTION-- -Simulates the file upload method post -test post raw #2 ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---POST_RAW-- -Content-type: multipart/form-data, boundary=AaB03x - ---AaB03x -content-disposition: form-data; name="flnm[]"; filename="file1.txt" -Content-Type: text/plain - -abcdef123456789 ---AaB03x -content-disposition: form-data; name="flnm[]"; filename="file2.txt" -Content-Type: text/plain - -«£¥§©®°±¶Я⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰» ---AaB03x ---FILEEOF-- -<?php - - -TestVariables\post_raw2(); - ---EXPECTF-- -name1 : file1.txt -name2 : file2.txt -type1 : text/plain -type2 : text/plain -error1 : 0 -error2 : 0 -size1 : 15 -size2 : 61 -content1 : abcdef123456789 -content2 : «£¥§©®°±¶Я⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰»
\ No newline at end of file diff --git a/tests/php/phpt/variables/027-env.phpt b/tests/php/phpt/variables/027-env.phpt deleted file mode 100644 index 4e84cfe..0000000 --- a/tests/php/phpt/variables/027-env.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -test superglobal _ENV ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---ENV-- -return <<<END -ENVVAR1=ENVVAL1 -HTTP_REFERER=http://spb.1gs.ru/ -HTTP_USER_AGENT=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 -HTTP_COOKIE=usr=1cfa6e9905; pc=0; PHPSESSID=4d08j9phpe1c6; vmode=0 -HTTP_HOST=phpcpp.com -END; ---FILEEOF-- -<?php - - -TestVariables\test_env(); -//var_export($_SERVER); echo PHP_EOL, PHP_EOL, PHP_EOL; - ---EXPECTF-- -HTTP_USER_AGENT => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 -ENVVAR1 => ENVVAL1 -HTTP_REFERER => http://spb.1gs.ru/ -REQUEST_METHOD => GET -HTTP_HOST => phpcpp.com diff --git a/tests/php/phpt/variables/028-compare1.phpt b/tests/php/phpt/variables/028-compare1.phpt deleted file mode 100644 index 2885fe8..0000000 --- a/tests/php/phpt/variables/028-compare1.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Test bool Value::operator==(const Value &value) const ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -TestVariables\test_compare1(); - ---EXPECT-- -true: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -false: -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -Compare array: -0 -0 -0 -1 -0 -Compare NULL: -0 -0 -0 -1 -1 -1
\ No newline at end of file diff --git a/tests/php/phpt/variables/029-compare2.phpt b/tests/php/phpt/variables/029-compare2.phpt deleted file mode 100644 index 333ede1..0000000 --- a/tests/php/phpt/variables/029-compare2.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -Test bool Value::operator< (const Value &value) const ---SKIPIF-- -<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> ---FILEEOF-- -<?php - -TestVariables\test_compare2(); - ---EXPECT-- -false: -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -true: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -false: -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -Compare array: -1 -1 -0 -1 -0 -1 -Compare NULL: -0 -0 -0 -1 -1 -1 -0 -0 -0
\ No newline at end of file diff --git a/tests/php/phpt/variables/readme b/tests/php/phpt/variables/readme deleted file mode 100644 index a47cb89..0000000 --- a/tests/php/phpt/variables/readme +++ /dev/null @@ -1,5 +0,0 @@ -tests variables - -TODO: more tests for globals variables -including separate test for $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER, $_REQUEST and $_ENV (Php::GET, Php::POST, Php::COOKIE, Php::FILES, Php::SERVER, Php::REQUEST and Php::ENV) variables. - diff --git a/tests/php/readme b/tests/php/readme deleted file mode 100644 index 15f54ec..0000000 --- a/tests/php/readme +++ /dev/null @@ -1,9 +0,0 @@ -The phpt documentation: -http://qa.php.net/phpt_details.php - -How to Write Tests -http://qa.php.net/write-test.php - -Lessons Learned from PHPT Writing -https://wiki.php.net/qa/phptlessonslearned - |