public function CollectionTest::testSlice in Plug 7
File
- lib/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ CollectionTest.php, line 181
Class
Namespace
Doctrine\Tests\Common\CollectionsCode
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);
}