Example #1
0
 public function testPaginator()
 {
     $paginator = $this->getMock('Nette\\Utils\\Paginator');
     // Data source expectation
     $this->table->setDataSource($this->dataSource);
     $this->dataSource->expects($this->once())->method('limit')->with(10, 0);
     // Paginator expectation
     $paginator->expects($this->once())->method('getItemsPerPage')->will($this->returnValue(10));
     $paginator->expects($this->once())->method('getOffset')->will($this->returnValue(0));
     $this->table->setPaginator($paginator);
     $this->assertInstanceOf('Nette\\Utils\\Paginator', $this->table->getPaginator());
     $this->assertSame($paginator, $this->table->getPaginator());
 }