DfpUser::ValidateUser PHP Method

ValidateUser() public method

Validates the user and throws a validation error if there are any errors.
public ValidateUser ( )
    public function ValidateUser()
    {
        if ($this->GetOAuth2Info() === null) {
            throw new ValidationException('OAuth2Info', null, 'OAuth 2.0 configuration is required.');
        }
        parent::ValidateOAuth2Info();
        if ($this->GetApplicationName() === null || trim($this->GetApplicationName()) === '' || strpos($this->GetApplicationName(), self::DEFAULT_APPLICATION_NAME) !== false) {
            throw new ValidationException('applicationName', null, sprintf("The property applicationName is required and cannot be " . "null, the empty string, or the default [%s]", self::DEFAULT_APPLICATION_NAME));
        }
    }

Usage Example

 /**
  * @expectedException ValidationException
  * @covers DfpUser::ValidateUser
  */
 public function testValidateUserWithDefaultUserAgentFailsWithValidationException()
 {
     $user = new DfpUser($this->authIniFilePath, 'INSERT_APPLICATION_NAME_HERE', 'networkCode', null, $this->mockOAuth2Credential);
     $user->ValidateUser();
 }