mapper = new SMTPMapper(); WPFunctions::set(Stub::make(new WPFunctions, [ '__' => function ($value) { return $value; }, ])); } public function testItCreatesSoftErrorForInvalidEmail() { $message = 'Invalid address (to): john@rambo.com'; $error = $this->mapper->getErrorFromException(new Exception($message), 'john@rambo.com'); expect($error->getLevel())->equals(MailerError::LEVEL_SOFT); } public function _after() { WPFunctions::set(new WPFunctions); } }