Hello

I have the following code that creates a new user. I am using PHPUnit to prepare test cases but however my code coverage is unable to cover the exception case i.e.
Code:
throw new Exception(__CLASS__ . ': Invalid data');
.

Can someone please show me how to cover the exception case in phpunit using assertInstanceOf() or something else?


Code:
​
/**
* Creates a new user
*
* @param string            $email
* @param UserType       $UserType
* @param string            $prefix
* @param string            $customFromName
* @param string            $customFromEmail
* @param string            $signature
*
* @return UserID
* @throws Exception If Invalid Data is Provided
*/
static public function Create($email, UserType $UserType, $prefix, $customFromName, $customFromEmail, $signature)
{
    if (!$UserType instanceof UserType) {
        throw new Exception(__CLASS__ . ': Invalid data');
    }

    $UserID = parent::Create($email, $UserType, $prefix, $customFromName, $customFromEmail, $signature, true);

    return $UserID;

}


Many thanks