public function testHandleOnFlushWithoutNewEmails() { $entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $uow = $this->getMockBuilder('\\Doctrine\\ORM\\UnitOfWork')->disableOriginalConstructor()->getMock(); $entityManager->expects($this->exactly(1))->method('getUnitOfWork')->will($this->returnValue($uow)); $uow->expects($this->once())->method('getScheduledEntityInsertions')->will($this->returnValue([new \stdClass()])); $this->manager->handleOnFlush(new OnFlushEventArgs($entityManager)); $this->assertCount(0, $this->manager->getQueue()); }