Example #1
0
 public function testFindBy()
 {
     $queryBuilder = $this->setUpQueryBuilder($value = 'bar');
     $queryBuilder->expects($this->once())->method('limit')->with($this->identicalTo($limit = 5))->will($this->returnSelf());
     $queryBuilder->expects($this->once())->method('skip')->with($this->identicalTo($offset = 10))->will($this->returnSelf());
     $queryBuilder->expects($this->once())->method('getQuery')->will($this->returnValue($query = $this->createQueryMock()));
     $query->expects($this->once())->method('getIterator')->will($this->returnValue($iterator = $this->createIteratorMock()));
     $iterator->expects($this->once())->method('toArray')->will($this->returnValue($result = ['result']));
     $this->assertSame($result, $this->repository->findBy(['foo' => $value], ['baz' => 'ASC'], $limit, $offset));
 }