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.
2018-05-12 14:10:59 +00:00
|
|
|
--TEST--
|
|
|
|
Test Collection::partition().
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
$array = ['abc', 'd', 'ef', 'ghij'];
|
|
|
|
$pair = Collection::init($array)->partition(function ($value) {
|
|
|
|
return strlen($value) % 2;
|
|
|
|
});
|
2018-08-28 14:11:09 +00:00
|
|
|
if ($pair->first != ['abc', 'd'] || $pair->second != ['ef', 'ghij']) {
|
2018-05-12 14:10:59 +00:00
|
|
|
echo 'Collection::partition() failed.', PHP_EOL;
|
2018-08-28 14:11:09 +00:00
|
|
|
}
|
2018-05-12 14:10:59 +00:00
|
|
|
?>
|
|
|
|
--EXPECT--
|