public function testGetSingleRootAliasWhenQueryHasNoRootAliasAndNoExceptionRequested() { $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock(); $qb->expects($this->once())->method('getRootAliases')->willReturn([]); $this->assertNull($this->doctrineHelper->getSingleRootAlias($qb, false)); }