コード例 #1
0
ファイル: AccessTokenTest.php プロジェクト: tonis-io/oauth2
 public function testFindOneWithScopesByToken()
 {
     $token = 'foo';
     $qbm = new QueryBuilderMocker($this);
     $qbm->select('token, scopes')->leftJoin('token.scopes', 'scopes')->where('token.token = :token')->setParameter('token', $token)->setMaxResults(1)->getQuery()->getSingleResult();
     $this->entityManager->shouldReceive('createQueryBuilder')->andReturn($qbm->getQueryBuilderMock());
     $this->repository->findOneWithScopesByToken($token);
 }
コード例 #2
0
 public function testCanMockChainedMethodCallsToQuery()
 {
     $qbm = new QueryBuilderMocker($this);
     $qbm->select('fieldName')->where('property = ?')->andWhere('otherProperty =:otherValue')->getQuery()->execute('it works!');
     $qb = $qbm->getQueryBuilderMock();
     $result = $qb->select('fieldName')->where('property = ?')->andWhere('otherProperty =:otherValue')->getQuery()->execute();
     $this->assertSame('it works!', $result);
 }