From 17b9d7df796cfcdd9c2e2d007a49091512d24d49 Mon Sep 17 00:00:00 2001 From: Andrew Hoffmann <andrew.hoffmann@wisc.edu> Date: Tue, 28 Apr 2015 14:47:09 -0500 Subject: [PATCH] Removed credentialCheck as it is deprecated in favor of checkLOA --- src/main/edu/wisc/doit/RpcNetidClient.php | 10 --- src/main/edu/wisc/doit/RpcNetidClientSoap.php | 32 -------- src/test/RpcNetidClientSoapTest.php | 74 ------------------- 3 files changed, 116 deletions(-) diff --git a/src/main/edu/wisc/doit/RpcNetidClient.php b/src/main/edu/wisc/doit/RpcNetidClient.php index 5eb63a4..be4e7db 100644 --- a/src/main/edu/wisc/doit/RpcNetidClient.php +++ b/src/main/edu/wisc/doit/RpcNetidClient.php @@ -30,16 +30,6 @@ interface RpcNetidClient { */ function lockStatus ( $uid ); - /** - * Checks the credentials (NetID, WisCard number, and DOB) of a UW-Madison person - * @param string $uid the uid of the user to search for (typically the NetID) - * @param DateTime $birthdate DOB for the UW-Person as a DateTime - * @param int $wiscard a 10-digit WisCard number - * @return bool true if credentials are verified, false if credential is unverified - * @throws edu\wisc\doit\RpcNetidClientSoapException if the response is unexcepted from web service - */ - function credentialCheck ( $uid, \DateTime $birthdate, $wiscard = null ); - /** * Changes the password for a given NetID * diff --git a/src/main/edu/wisc/doit/RpcNetidClientSoap.php b/src/main/edu/wisc/doit/RpcNetidClientSoap.php index f8de806..f46ee03 100644 --- a/src/main/edu/wisc/doit/RpcNetidClientSoap.php +++ b/src/main/edu/wisc/doit/RpcNetidClientSoap.php @@ -93,38 +93,6 @@ class RpcNetidClientSoap implements RpcNetidClient { RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE ); } - - /** - * (non-PHPdoc) - * @see \edu\wisc\doit\RpcNetidClient::credentialCheck() - */ - function credentialCheck ( $uid, \DateTime $birthdate, $wiscard = null ){ - - if ( is_string($uid) !== true ){ - throw new \DomainException("uid parameter must be a string"); - } - - if( is_int($wiscard) !== true && ($wiscard !== null)){ - throw new \DomainException("wiscard parameter must be an int or empty"); - } - - if($wiscard === null) { $wiscard = ""; } - - $result = $this->getSoapClient()->credentialCheck( array( 'uid' => $uid, 'cardid' => $wiscard, 'birthdate' => $birthdate->format("m-d-Y") ) ); - - if($result->result === 200){ - return true; - } - - if($result->result === 400){ - return false; - } - - throw new RpcNetidClientSoapException("Unexpected status code: {$result->result}", - RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE ); - - } - /** * (non-PHPdoc) * @see \edu\wisc\doit\RpcNetidClient::checkLOA() diff --git a/src/test/RpcNetidClientSoapTest.php b/src/test/RpcNetidClientSoapTest.php index 46fb41a..04bb59d 100644 --- a/src/test/RpcNetidClientSoapTest.php +++ b/src/test/RpcNetidClientSoapTest.php @@ -149,80 +149,6 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase { $this->assertEquals("Locked out of password reset - too many attempts", $returnValue->getReason()); } - /** - * @test - * @expectedException DomainException - */ - function credentialCheck_UidIsNotString(){ - $client = new RpcNetidClientSoap($this->mockSoapClient); - $birthdate = new \DateTime(); - $returnValue = $client->credentialCheck(123, $birthdate, 123); - } - - /** - * @test - * @expectedException DomainException - */ - function credentialCheck_WiscardIsNotInt(){ - $client = new RpcNetidClientSoap($this->mockSoapClient); - $birthdate = new \DateTime(); - $returnValue = $client->credentialCheck("uid", $birthdate, "A123"); - } - - - /** - * @test - * @expectedException edu\wisc\doit\RpcNetidClientSoapException - * @expectedExceptionCode 100 - */ - function credentialCheck_UnexpectedStatusCodeFromWebService(){ - $result = new stdClass(); - $result->result = 500; - $this->mockSoapClient->expects($this->any())->method('credentialCheck')->will($this->returnValue($result)); - $client = new RpcNetidClientSoap($this->mockSoapClient); - $birthdate = new \DateTime(); - $returnValue = $client->credentialCheck("uid", $birthdate, 123); - } - - /** - * @test Valid call to checkCredential that returns false - */ - function credentialCheck_validCall_ReturnsFalse(){ - $result = new stdClass(); - $result->result = 400; - $this->mockSoapClient->expects($this->any())->method('credentialCheck')->will($this->returnValue($result)); - $client = new RpcNetidClientSoap($this->mockSoapClient); - $birthdate = new \DateTime(); - $returnValue = $client->credentialCheck("uid", $birthdate, 123); - $this->assertFalse($returnValue); - } - - /** - * @test Valid call to checkCredential that returns true - */ - function credentialCheck_validCall_ReturnsTrue(){ - $result = new stdClass(); - $result->result = 200; - $this->mockSoapClient->expects($this->any())->method('credentialCheck')->will($this->returnValue($result)); - $client = new RpcNetidClientSoap($this->mockSoapClient); - $birthdate = new \DateTime(); - $returnValue = $client->credentialCheck("uid", $birthdate, 123); - $this->assertTrue($returnValue); - } - - /** - * @test Valid call to checkCredential that returns true with empty wiscard - */ - function credentialCheck_validCallWithEmpty_ReturnsTrue(){ - $result = new stdClass(); - $result->result = 200; - $this->mockSoapClient->expects($this->any())->method('credentialCheck')->will($this->returnValue($result)); - $client = new RpcNetidClientSoap($this->mockSoapClient); - $birthdate = new \DateTime(); - $returnValue = $client->credentialCheck("uid", $birthdate); - $this->assertTrue($returnValue); - } - /** * @test * @expectedException DomainException -- GitLab