예제 #1
0
 /**
  * @dataProvider getSearchData
  *
  * @param int $limit
  * @param int $offset
  * @param string $sort_column
  * @param string $sort_direction
  */
 public function testSearch($limit, $offset, $sort_column, $sort_direction)
 {
     /* @var $data \PHPUnit_Framework_MockObject_MockObject|Search */
     $data = $this->getMock('\\AnimeDb\\Bundle\\CatalogBundle\\Entity\\Search');
     $expected = ['foo', 'bar'];
     $this->driver->expects($this->once())->method('search')->will($this->returnValue($expected))->with($data, $limit > 0 ? (int) $limit : 0, $offset > 0 ? (int) $offset : 0, $this->manager->getValidSortColumn($sort_column), $this->manager->getValidSortDirection($sort_direction));
     $this->assertEquals($expected, $this->manager->search($data, $limit, $offset, $sort_column, $sort_direction));
 }