diff options
Diffstat (limited to 'tests/php')
-rw-r--r-- | tests/php/dbg.php | 2 | ||||
-rw-r--r-- | tests/php/phpt/variables/005-cast-objects-to-scalars.phpt | 22 | ||||
-rw-r--r-- | tests/php/phpt/variables/readme | 4 |
3 files changed, 26 insertions, 2 deletions
diff --git a/tests/php/dbg.php b/tests/php/dbg.php index 4728700..2040f01 100644 --- a/tests/php/dbg.php +++ b/tests/php/dbg.php @@ -12,5 +12,3 @@ -//--------- -TestValueIterator\loopArray();
\ No newline at end of file diff --git a/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt b/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt new file mode 100644 index 0000000..335acb7 --- /dev/null +++ b/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt @@ -0,0 +1,22 @@ +--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 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
\ No newline at end of file diff --git a/tests/php/phpt/variables/readme b/tests/php/phpt/variables/readme index 8162526..a47cb89 100644 --- a/tests/php/phpt/variables/readme +++ b/tests/php/phpt/variables/readme @@ -1 +1,5 @@ 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. + |