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-07-22 16:23:46 +00:00
|
|
|
--TEST--
|
|
|
|
Test Collection::slice().
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
$array = [1, 2, 3, 4, 5, 6];
|
|
|
|
$collection = Collection::init($array)->slice([2, -1, 3, 6]);
|
|
|
|
$array1 = ['a' => 'b', 'c' => 'd', 'e' => 'f'];
|
|
|
|
$collection1 = Collection::init($array1)->slice(['c', 'a', 'g']);
|
2018-08-28 14:11:09 +00:00
|
|
|
if ($collection->toArray() != [3, 4] || $collection1->toArray() != ['c' => 'd', 'a' => 'b']) {
|
2018-07-22 16:23:46 +00:00
|
|
|
echo 'Collection::slice() failed.', PHP_EOL;
|
2018-08-28 14:11:09 +00:00
|
|
|
}
|
2018-07-22 16:23:46 +00:00
|
|
|
?>
|
|
|
|
--EXPECT--
|