diff --git a/src/main/edu/wisc/doit/RpcNetidClient.php b/src/main/edu/wisc/doit/RpcNetidClient.php index 5eb63a44c713311d36db8fa1bf3c3f3765c9eb38..be4e7dbffc0c90563cfca280b8ad2ee974c132b6 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 f8de8062f7e360f624c187170245b54cf3dc9eb4..f46ee033f0babd20e8b5c80f0bf018af78d0f0b7 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 46fb41a8721cc4e0120f5ae5dba8a20b317909b2..04bb59d0011d2d9257223dada9d8e524be802e01 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