public function testPreviousOrFirstReturnsFirstPageable() { $pageable = new Pageable(1, 20, new Sort(), new Filter($this->filterableAttributes)); $result = $pageable->previousOrFirst(); $this->assertEquals(1, $result->pageNumber()); $this->assertEquals(20, $result->pageSize()); $this->assertFalse($result->hasPrevious()); $this->assertEquals(20, $result->offset()); $this->assertEquals(new Sort(), $result->sortings()); $this->assertEquals(new Filter($this->filterableAttributes), $result->filters()); }
/** * Returns the Pageable to request the previous Page. * * @return PageableInterface */ public function previousPageable() : PageableInterface { $pageable = new Pageable($this->pageNumber(), $this->pageSize(), $this->sortings(), $this->filters(), $this->fields()); return $pageable->previousOrFirst(); }