Skip to content
Snippets Groups Projects
Commit b299ce8b authored by Matt Trefilek's avatar Matt Trefilek
Browse files

Merge branch 'master' into 'master'

Wrap in array if needed

See merge request !4
parents a5a544d7 5777fb47
No related branches found
No related tags found
1 merge request!4Wrap in array if needed
......@@ -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}",
......
......@@ -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
......
......@@ -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() );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment