This repository has been archived on 2020-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
ext-collections/tests/015-drop-while.phpt

20 lines
533 B
PHP

--TEST--
Test Collection::dropWhile() and Collection::dropLastWhile().
--FILE--
<?php
$collection = Collection::init([5, 7, 1, 4, 3]);
$collection1 = $collection->dropWhile(function ($value) {
return $value % 2;
});
if (array_values($collection1->toArray()) != [4, 3]) {
echo 'Collection::dropWhile() failed.', PHP_EOL;
}
$collection1 = $collection->dropLastWhile(function ($value) {
return $value < 6;
});
if ($collection1->toArray() != [5, 7]) {
echo 'Collection::dropLastWhile() failed.', PHP_EOL;
}
?>
--EXPECT--