Skip to content
Snippets Groups Projects
Commit 17b9d7df authored by Andrew Hoffmann's avatar Andrew Hoffmann
Browse files

Removed credentialCheck as it is deprecated in favor of checkLOA

parent ead2472b
No related branches found
No related tags found
No related merge requests found
...@@ -30,16 +30,6 @@ interface RpcNetidClient { ...@@ -30,16 +30,6 @@ interface RpcNetidClient {
*/ */
function lockStatus ( $uid ); 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 * Changes the password for a given NetID
* *
......
...@@ -93,38 +93,6 @@ class RpcNetidClientSoap implements RpcNetidClient { ...@@ -93,38 +93,6 @@ class RpcNetidClientSoap implements RpcNetidClient {
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE ); 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) * (non-PHPdoc)
* @see \edu\wisc\doit\RpcNetidClient::checkLOA() * @see \edu\wisc\doit\RpcNetidClient::checkLOA()
......
...@@ -149,80 +149,6 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase { ...@@ -149,80 +149,6 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals("Locked out of password reset - too many attempts", $returnValue->getReason()); $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 * @test
* @expectedException DomainException * @expectedException DomainException
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment