From ce3efd3b6f504a8ca5fbd495e04cdbe026662c16 Mon Sep 17 00:00:00 2001
From: Matt Trefilek <matthew.trefilek@wisc.edu>
Date: Thu, 5 Oct 2017 15:25:03 -0500
Subject: [PATCH] Updating to new phpunit version

---
 .gitignore                                          | 5 ++++-
 build.xml                                           | 2 +-
 src/main/edu/wisc/doit/RpcNetidClient.php           | 2 +-
 src/main/edu/wisc/doit/RpcNetidClientSoap.php       | 4 ++--
 src/test/CertificateServiceTest.php                 | 4 +++-
 src/test/RpcNetidClientSoapTest.php                 | 8 ++++----
 src/test/integration-tests/RpcNetidClientSoapIT.php | 6 +++---
 7 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index dd1e8f5..180786f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,4 +21,7 @@
 /src/test/resources/pemtest.pem
 /src/test/resources/integration-test-data.ini
 
-.DS_Store
\ No newline at end of file
+.DS_Store
+
+*.iml
+.idea
\ No newline at end of file
diff --git a/build.xml b/build.xml
index 189995c..0ad0cd5 100644
--- a/build.xml
+++ b/build.xml
@@ -81,7 +81,7 @@
 	
 	<!-- Updates phpunit -->
 	<target name="update-phpunit" depends="get-phpunit" >
-		<exec command="php phpunit.phar --self-update" passthru="true" checkreturn="true" />
+		<exec command="php phpunit.phar" passthru="true" checkreturn="true" />
 	</target>
 	
 	<!-- Creates a release -->
diff --git a/src/main/edu/wisc/doit/RpcNetidClient.php b/src/main/edu/wisc/doit/RpcNetidClient.php
index 5d99fdc..74af635 100644
--- a/src/main/edu/wisc/doit/RpcNetidClient.php
+++ b/src/main/edu/wisc/doit/RpcNetidClient.php
@@ -77,7 +77,7 @@ interface RpcNetidClient {
 	 * @param string $password  the password
 	 * @return RpcNetidStructValidationResponse  indicates if valid and the reason for invalid
 	 */
-	function passwordChoicePolicyCheck( $password );
+	function passwordChoicePolicyCheck( $uid, $password );
 	
 	/**
 	 * Verifies the identity of a UW-Madison user using his or her NetID, date of birth, 
diff --git a/src/main/edu/wisc/doit/RpcNetidClientSoap.php b/src/main/edu/wisc/doit/RpcNetidClientSoap.php
index 0556dde..1680ab2 100644
--- a/src/main/edu/wisc/doit/RpcNetidClientSoap.php
+++ b/src/main/edu/wisc/doit/RpcNetidClientSoap.php
@@ -285,12 +285,12 @@ class RpcNetidClientSoap implements RpcNetidClient {
 	 * (non-PHPdoc)
 	 * @see \edu\wisc\doit\RpcNetidClient::passwordChoicePolicyCheck()
 	 */
-	public function passwordChoicePolicyCheck( $password ){
+	public function passwordChoicePolicyCheck( $uid, $password ){
 		if(is_string($password) !== true){
 			throw new \DomainException("password parameter must be a string");
 		}
 		
-		$result = $this->getSoapClient()->passwordChoicePolicyCheck( array('password' => $password) );
+		$result = $this->getSoapClient()->passwordChoicePolicyCheck( array('uid' => $uid, 'password' => $password) );
 		
 		if( $result->result === 200){
 			return new RpcNetidStructValidationResponse(true, array() );
diff --git a/src/test/CertificateServiceTest.php b/src/test/CertificateServiceTest.php
index 928e66b..94dfbe1 100644
--- a/src/test/CertificateServiceTest.php
+++ b/src/test/CertificateServiceTest.php
@@ -2,13 +2,15 @@
 
 use edu\wisc\doit\CertificateService;
 
+require_once 'vendor/Autoload.php';
+
 /**
  * Unit tests for the edu\wisc\doit\CertificateService class.
  * 
  * These tests rely on self-signed certificates in the /src/test/resources folder.
  */
 
-class CertificateServiceTest extends PHPUnit_Framework_TestCase {
+class CertificateServiceTest extends PHPUnit\Framework\TestCase {
 	
 	private $cert;
 	private $key;
diff --git a/src/test/RpcNetidClientSoapTest.php b/src/test/RpcNetidClientSoapTest.php
index 45332f0..de03d7e 100644
--- a/src/test/RpcNetidClientSoapTest.php
+++ b/src/test/RpcNetidClientSoapTest.php
@@ -17,7 +17,7 @@ use edu\wisc\doit\RpcNetidStructValidationResponse;
  * @see https://phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubbing-and-mocking-web-services PHPUnit: Stubbing and Mocking Web Services
  */
 
-class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
+class RpcNetidClientSoapTest extends PHPUnit\Framework\TestCase {
 
 	private $config;
 	private $cert;
@@ -488,7 +488,7 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
 		
 		$this->mockSoapClient->expects($this->any())->method('passwordChoicePolicyCheck')->will($this->returnValue($result));
 		$client = new RpcNetidClientSoap($this->mockSoapClient);
-		$returnValue = $client->passwordChoicePolicyCheck("password");
+		$returnValue = $client->passwordChoicePolicyCheck("uid", "password");
 		
 		$this->assertFalse($returnValue->getIsValid());
 		$this->assertEquals($result->Reasons->Reason, $returnValue->getReasons());
@@ -507,7 +507,7 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
 		$result->Reasons->Reason = array( "Invalid Arguments" );
 		$this->mockSoapClient->expects($this->any())->method('passwordChoicePolicyCheck')->will($this->returnValue($result));
 		$client = new RpcNetidClientSoap($this->mockSoapClient);
-		$returnValue = $client->passwordChoicePolicyCheck("password");
+		$returnValue = $client->passwordChoicePolicyCheck("uid", "password");
 		
 		$this->assertFalse($returnValue->getIsValid());
 		$this->assertEquals($result->Reasons->Reason, $returnValue->getReasons());
@@ -524,7 +524,7 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
 		
 		$this->mockSoapClient->expects($this->any())->method('passwordChoicePolicyCheck')->will($this->returnValue($result));
 		$client = new RpcNetidClientSoap($this->mockSoapClient);
-		$returnValue = $client->passwordChoicePolicyCheck("password");
+		$returnValue = $client->passwordChoicePolicyCheck("uid", "password");
 		
 		$this->assertTrue($returnValue->getIsValid());
 		
diff --git a/src/test/integration-tests/RpcNetidClientSoapIT.php b/src/test/integration-tests/RpcNetidClientSoapIT.php
index 1870d44..43a0dac 100644
--- a/src/test/integration-tests/RpcNetidClientSoapIT.php
+++ b/src/test/integration-tests/RpcNetidClientSoapIT.php
@@ -18,7 +18,7 @@ use edu\wisc\doit\RpcNetidStructValidationResponse;
  * 
  */
 
-class RpcNetidClientSoapIT extends PHPUnit_Framework_TestCase {
+class RpcNetidClientSoapIT extends PHPUnit\Framework\TestCase {
 	
 	/** @var array */
 	private static $testData = false;
@@ -249,13 +249,13 @@ class RpcNetidClientSoapIT extends PHPUnit_Framework_TestCase {
 	
 	/** @test */
 	public function passwordChoicePolicyCheck_validPassword() {
-		$result = self::$client->passwordChoicePolicyCheck( self::$testData['user']['password'] );
+		$result = self::$client->passwordChoicePolicyCheck(self::$testData['user']['uid'],  self::$testData['user']['password'] );
 		$this->assertTrue( $result->getIsValid() );
 	}
 	
 	/** @test */
 	public function passwordChoicePolicyCheck_invalidPassword() {
-		$result = self::$client->passwordChoicePolicyCheck( self::$testData['invalid-user']['password'] );
+		$result = self::$client->passwordChoicePolicyCheck( self::$testData['invalid-user']['uid'], self::$testData['invalid-user']['password'] );
 		$this->assertFalse( $result->getIsValid() );
 		$this->assertNotEmpty( $result->getReasons() );
 	}
-- 
GitLab