Skip to content

Commit

Permalink
Mock basic method of the QueryBuilder (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Jul 18, 2021
1 parent a51aa67 commit 61fcca5
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Test/EntityManagerMockFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,27 @@ final protected function createEntityManagerMock(\Closure $qbCallback, array $fi

$qb = $this->createMock(QueryBuilder::class);

$qb->method('select')->willReturn($qb);
$qb->method('getQuery')->willReturn($query);
$qb->method('distinct')->willReturn($qb);
$qb->method('from')->willReturn($qb);
$qb->method('select')->willReturn($qb);
$qb->method('addSelect')->willReturn($qb);
$qb->method('where')->willReturn($qb);
$qb->method('orderBy')->willReturn($qb);
$qb->method('andWhere')->willReturn($qb);
$qb->method('orWhere')->willReturn($qb);
$qb->method('setParameter')->willReturn($qb);
$qb->method('setParameters')->willReturn($qb);
$qb->method('setFirstResult')->willReturn($qb);
$qb->method('setMaxResults')->willReturn($qb);
$qb->method('groupBy')->willReturn($qb);
$qb->method('addGroupBy')->willReturn($qb);
$qb->method('having')->willReturn($qb);
$qb->method('andHaving')->willReturn($qb);
$qb->method('orHaving')->willReturn($qb);
$qb->method('orderBy')->willReturn($qb);
$qb->method('addOrderBy')->willReturn($qb);
$qb->method('join')->willReturn($qb);
$qb->method('innerJoin')->willReturn($qb);
$qb->method('leftJoin')->willReturn($qb);

$qbCallback($qb);
Expand Down

0 comments on commit 61fcca5

Please sign in to comment.