diff --git a/.gitignore b/.gitignore index dd1e8f5de6470c75fd340252465aec249e527345..180786fad3ac794b7745808746faa0c1a59f3519 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 189995c8129a6e25ddcb9cb82efc4df11d0bef25..0ad0cd5ac21e058bf5a95784628b7fb185b9f5f6 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 5d99fdcbc84be4fc6f39858b959adc1f8fba80f3..74af635d673aec9159b96b497da2138eb1436d23 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 0556dde78de69f800ae5306d154b1ae77ebda629..1680ab20badbbef5c33cafb8bb213ed365372982 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 928e66b97a4166573167137beef922d473244da1..94dfbe1f9ab01bc8813be6f6694cae14e6e3767d 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 45332f013baf7b501be03d63d4822a93d6711ad9..de03d7eeda0a1766a6bea808123373d52bc37913 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 1870d443f1f7a71c1f647c62b21bd9c5bee0a9d9..43a0dac7b78f333e3f8184be0c7f0e07758cd68c 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() ); }