diff --git a/src/main/edu/wisc/doit/RpcNetidClientSoap.php b/src/main/edu/wisc/doit/RpcNetidClientSoap.php index d3252419bb30fba6fb90fd3feb76f870c000ac8b..1680ab20badbbef5c33cafb8bb213ed365372982 100644 --- a/src/main/edu/wisc/doit/RpcNetidClientSoap.php +++ b/src/main/edu/wisc/doit/RpcNetidClientSoap.php @@ -297,11 +297,11 @@ class RpcNetidClientSoap implements RpcNetidClient { } if( $result->result === 400){ - return new RpcNetidStructValidationResponse(false, array($result->Reasons->Reason) ); + return new RpcNetidStructValidationResponse(false, $result->Reasons->Reason ); } if( $result->result === 401){ - return new RpcNetidStructValidationResponse(false, array($result->Reasons->Reason) ); + return new RpcNetidStructValidationResponse(false, $result->Reasons->Reason ); } throw new RpcNetidClientSoapException("Unexpected status code: {$result->result}", diff --git a/src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php b/src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php index 2301a03f8a01a0d7d311835410adfedfc2ffa232..eb68ef021d3154d77ca5957bc9f69f8316f264e4 100644 --- a/src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php +++ b/src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php @@ -25,7 +25,12 @@ class RpcNetidStructValidationResponse { * @param array $reasons the array of a Reason for why the SOAP Call failed */ function __construct( $isValid, array $reasons ) { - $this->setIsValid( $isValid ); + if(gettype($reasons) == "array") { + $this->setIsValid( $isValid ); + } else { + $this->setIsValid(array( $isValid) ); + } + $this->setReasons( $reasons ); } @@ -45,7 +50,7 @@ class RpcNetidStructValidationResponse { /** * @return string the reason for a password being invalid */ - function getReasons() { return $this->reasons[0]; } + function getReasons() { return $this->reasons; } /** * @param string[] $reason the reason for a password being invalid diff --git a/src/test/RpcNetidClientSoapTest.php b/src/test/RpcNetidClientSoapTest.php index 44dcd85e16cac974e0927e987a086714b7510668..de03d7eeda0a1766a6bea808123373d52bc37913 100644 --- a/src/test/RpcNetidClientSoapTest.php +++ b/src/test/RpcNetidClientSoapTest.php @@ -626,7 +626,7 @@ class RpcNetidClientSoapTest extends PHPUnit\Framework\TestCase { $this->assertInstanceOf('edu\wisc\doit\RpcNetidStructValidationResponse', $returned ); $this->assertFalse( $returned->getIsValid() ); - $this->assertEquals( RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD, $returned->getReasons() ); + $this->assertContains( RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD, $returned->getReasons() ); }