diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-29 13:10:46 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-29 13:10:46 +0100 |
commit | 7b7efa4f80dc5c9d26b59087270a8d89fedcc808 (patch) | |
tree | 1dfb0ce4a6662a5bcb6562b40ab91f813a959afc /tests/php/phpt/variables/005-cast-objects-to-scalars.phpt | |
parent | c0e1f20eeab6445d6355ea11ef7d264cb37c52cf (diff) | |
parent | 8bd7f5162870e4b39c7629c1a67a3372402406c9 (diff) |
Merge pull request #56 from valmat/tests
New tests
Diffstat (limited to 'tests/php/phpt/variables/005-cast-objects-to-scalars.phpt')
-rw-r--r-- | tests/php/phpt/variables/005-cast-objects-to-scalars.phpt | 22 |
1 files changed, 22 insertions, 0 deletions
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..9de9ba5 --- /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 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 |