From 8793b20bd83f3aefc42e329ab473d7e04c590456 Mon Sep 17 00:00:00 2001
From: Matt Trefilek <matthew.trefilek@wisc.edu>
Date: Fri, 6 Oct 2017 16:23:18 -0500
Subject: [PATCH] Maintains functionality with current code

---
 src/main/edu/wisc/doit/RpcNetidClientSoap.php               | 4 ++--
 src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php | 4 ++--
 src/test/RpcNetidClientSoapTest.php                         | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/edu/wisc/doit/RpcNetidClientSoap.php b/src/main/edu/wisc/doit/RpcNetidClientSoap.php
index 1e21501..d325241 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, $result->Reasons );
+			return new RpcNetidStructValidationResponse(false, array($result->Reasons->Reason) );
 		}
 		
 		if( $result->result === 401){
-			return new RpcNetidStructValidationResponse(false, $result->Reasons  );
+			return new RpcNetidStructValidationResponse(false, array($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 48b6741..2301a03 100644
--- a/src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php
+++ b/src/main/edu/wisc/doit/RpcNetidStructValidationResponse.php
@@ -22,7 +22,7 @@ class RpcNetidStructValidationResponse {
 	
 	/**
 	 * @param bool $isValid
-	 * @param array $reasons the array of Reason(s) for why the SOAP Call failed
+	 * @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
diff --git a/src/test/RpcNetidClientSoapTest.php b/src/test/RpcNetidClientSoapTest.php
index de03d7e..44dcd85 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->assertContains( RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD, $returned->getReasons() );
+		$this->assertEquals( RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD, $returned->getReasons() );
 		
 	}
 	
-- 
GitLab