You are here

public function CollectionTest::testSlice in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php \Doctrine\Tests\Common\Collections\CollectionTest::testSlice()

File

vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php, line 181

Class

CollectionTest

Namespace

Doctrine\Tests\Common\Collections

Code

public function testSlice() {
  $this->collection[] = 'one';
  $this->collection[] = 'two';
  $this->collection[] = 'three';
  $slice = $this->collection
    ->slice(0, 1);
  $this
    ->assertInternalType('array', $slice);
  $this
    ->assertEquals(array(
    'one',
  ), $slice);
  $slice = $this->collection
    ->slice(1);
  $this
    ->assertEquals(array(
    1 => 'two',
    2 => 'three',
  ), $slice);
  $slice = $this->collection
    ->slice(1, 1);
  $this
    ->assertEquals(array(
    1 => 'two',
  ), $slice);
}