diff options
Diffstat (limited to 'ext/spl/tests/fixedarray_005.phpt')
-rw-r--r-- | ext/spl/tests/fixedarray_005.phpt | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ext/spl/tests/fixedarray_005.phpt b/ext/spl/tests/fixedarray_005.phpt index 9ccc693d55..cc64fd01b0 100644 --- a/ext/spl/tests/fixedarray_005.phpt +++ b/ext/spl/tests/fixedarray_005.phpt @@ -1,12 +1,30 @@ --TEST-- -SPL: FixedArray: Trying to instantiate passing object to constructor parameter +SPL: FixedArray: Invalid arguments --FILE-- <?php -$b = new stdClass; +try { + $a = new SplFixedArray(new stdClass); +} catch (TypeError $iae) { + echo "Ok - ".$iae->getMessage().PHP_EOL; +} -$a = new SplFixedArray($b); +try { + $a = new SplFixedArray('FOO'); +} catch (TypeError $iae) { + echo "Ok - ".$iae->getMessage().PHP_EOL; +} + +try { + $a = new SplFixedArray(''); +} catch (TypeError $iae) { + echo "Ok - ".$iae->getMessage().PHP_EOL; +} ?> ---EXPECTF-- -Warning: SplFixedArray::__construct() expects parameter 1 to be long, object given in %s on line %d +===DONE=== +--EXPECT-- +Ok - SplFixedArray::__construct() expects parameter 1 to be integer, object given +Ok - SplFixedArray::__construct() expects parameter 1 to be integer, string given +Ok - SplFixedArray::__construct() expects parameter 1 to be integer, string given +===DONE=== |