1
0
mirror of https://github.com/php/php-src.git synced 2026-04-14 03:22:58 +02:00
Files
archived-php-src/Zend/tests/iterable_or_null.phpt
Nikita Popov dbe5725ff3 Rename zend-test to zend_test
The extension name should match the name of the ext/ directory,
otherwise it will not get picked up by run-tests. It would be possible
to remap this in run-tests, but I think it's better to rename the
extension to follow the standard format. Other extensions also
use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql).
Of course, the ./configure option remains hyphenated.

Closes GH-6613.
2021-01-19 15:28:15 +01:00

50 lines
1.1 KiB
PHP

--TEST--
Test Z_PARAM_ITERABLE() and Z_PARAM_ITERABLE_OR_NULL
--SKIPIF--
<?php
if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded');
?>
--FILE--
<?php
try {
var_dump(zend_iterable("string"));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
var_dump(zend_iterable(1));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
var_dump(zend_iterable(null));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
zend_iterable([]);
zend_iterable([], []);
$iterator = new ArrayIterator([]);
zend_iterable($iterator);
zend_iterable($iterator, $iterator);
zend_iterable($iterator, null);
try {
var_dump(zend_iterable([], "string"));
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECT--
zend_iterable(): Argument #1 ($arg1) must be of type iterable, string given
zend_iterable(): Argument #1 ($arg1) must be of type iterable, int given
zend_iterable(): Argument #1 ($arg1) must be of type iterable, null given
zend_iterable(): Argument #2 ($arg2) must be of type ?iterable, string given