objectManagerHelper = new ObjectManagerHelper($this); $this->object = $this->objectManagerHelper ->getObject(\Magento\Customer\Model\Customer\CredentialsValidator::class); } /** * @expectedException \Magento\Framework\Exception\InputException */ public function testCheckPasswordDifferentFromEmail() { $email = 'test1@example.com'; $password = strtoupper($email); // for case-insensitive check $this->object->checkPasswordDifferentFromEmail($email, $password); $this->expectExceptionMessage( "The password can't be the same as the email address. Create a new password and try again." ); } }