/** * @test */ public function generateAndSend_generateNewCode_sendMail() { //Stub the user object $user = $this->createMock('Scheb\\TwoFactorBundle\\Model\\Email\\TwoFactorInterface'); //Mock the mailer $this->mailer->expects($this->once())->method('sendAuthCode')->with($user); $this->authCodeManager->generateAndSend($user); }