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

Merge branch 'master' into 'master'

Change Reason string to array of reasons

See merge request !3
parents a338fa28 8793b20b
No related branches found
No related tags found
1 merge request!3Change Reason string to array of reasons
......@@ -10,6 +10,7 @@
/phpunit.phar
/docs
/modules
/go-pear.phar
/src/main/wsdltophp/prod/RPCNetID/*
/src/main/wsdltophp/prod/RPCNetID/.gitkeep
......
......@@ -73,7 +73,8 @@ interface RpcNetidClient {
/**
* Validates a NetID password meets complexity requirements
*
*
* @param string $uid the user's netid
* @param string $password the password
* @return RpcNetidStructValidationResponse indicates if valid and the reason for invalid
*/
......
......@@ -297,11 +297,11 @@ class RpcNetidClientSoap implements RpcNetidClient {
}
if( $result->result === 400){
return new RpcNetidStructValidationResponse(false, $result->Reasons->Reason );
return new RpcNetidStructValidationResponse(false, array($result->Reasons->Reason) );
}
if( $result->result === 401){
return new RpcNetidStructValidationResponse(false, $result->Reasons->Reason );
return new RpcNetidStructValidationResponse(false, array($result->Reasons->Reason) );
}
throw new RpcNetidClientSoapException("Unexpected status code: {$result->result}",
......
......@@ -22,7 +22,7 @@ class RpcNetidStructValidationResponse {
/**
* @param bool $isValid
* @param string $reason
* @param array $reasons the array of a Reason for why the SOAP Call failed
*/
function __construct( $isValid, array $reasons ) {
$this->setIsValid( $isValid );
......@@ -45,7 +45,7 @@ class RpcNetidStructValidationResponse {
/**
* @return string the reason for a password being invalid
*/
function getReasons() { return $this->reasons; }
function getReasons() { return $this->reasons[0]; }
/**
* @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->assertContains( RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD, $returned->getReasons() );
$this->assertEquals( 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