/** * @test */ public function calculateDisplayRangeDeterminesCorrectDisplayRangeStartAndEndForOddMaximumNumberOfLinksWhenOnLastPage() { $this->controller->_set('maximumNumberOfLinks', 7); $this->controller->_set('numberOfPages', 100); $this->controller->_set('currentPage', 100); $this->controller->_call('calculateDisplayRange'); $this->assertSame(94, $this->controller->_get('displayRangeStart')); $this->assertSame(100, $this->controller->_get('displayRangeEnd')); }
/** * @test */ public function prepareObjectsSliceReturnsCorrectPortionForArrayAndSecondPage() { $this->controller->_set('currentPage', 2); $objects = array(); for ($i = 0; $i <= 55; $i++) { $item = new \stdClass(); $objects[] = $item; } $this->controller->_set('objects', $objects); $expectedPortion = array(); for ($j = 10; $j <= 19; $j++) { $expectedPortion = array_slice($objects, 10, 10); } $this->assertSame($expectedPortion, $this->controller->_call('prepareObjectsSlice', 10, 10)); }