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

Merged uwmadison_doit/rpc-netid-php into master

parents bcca3676 0c496a0e
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
/.project
/.settings
/.vagrant
/.idea
/composer.lock
/vendor
/composer.phar
......
......@@ -131,20 +131,20 @@ class RpcNetidClientSoap implements RpcNetidClient {
return new RpcNetidStructValidationResponse(false, array());
break;
case 401:
throw new RpcNetidClientSoapException("Web service returned 401: invalid input parameters",
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE );
return new RpcNetidStructValidationResponse( false, array("Web service returned 401: invalid input
parameters"));
break;
case 402:
throw new RpcNetidClientSoapException("Web service returned 402: no PVI found for uid",
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE );
return new RpcNetidStructValidationResponse( false, array("Web service returned 402: no PVI found for
uid") );
break;
case 403:
throw new RpcNetidClientSoapException("Web service returned 403: no LOA found for uid",
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE );
return new RpcNetidStructValidationResponse( false, array("Web service returned 403: no LOA found for
uid") );
break;
case 404:
throw new RpcNetidClientSoapException("Web service returned 404: no Wiscard eligibility data found for uid",
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE );
return new RpcNetidStructValidationResponse( false, array("Web service returned 404: no Wiscard
eligibility data found for uid"));
break;
case 405:
return new RpcNetidStructValidationResponse(false, array(RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD ) );
......
......@@ -564,66 +564,66 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
}
/**
* @test throws exception if web service returns 401 (invalid parameters)
* @expectedException edu\wisc\doit\RpcNetidClientSoapException
* @expectedExceptionCode 100
* @test returns false if web service returns 401 (invalid parameters)
*/
function checkLOA_401_throws() {
function checkLOA_401_returns_false() {
$result = new stdClass();
$result->result = 401;
$this->mockSoapClient->expects($this->any())->method('checkLOA')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$returned = $client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$this->assertInstanceOf('edu\wisc\doit\RpcNetidStructValidationResponse', $returned );
$this->assertFalse( $returned->getIsValid() );
}
/**
* @test throws exception if web service returns 402 (No PVI found for UID)
* @expectedException edu\wisc\doit\RpcNetidClientSoapException
* @expectedExceptionCode 100
* @test returns false if web service returns 402 (No PVI found for UID)
*/
function checkLOA_402_throws() {
function checkLOA_402_returns_false() {
$result = new stdClass();
$result->result = 402;
$this->mockSoapClient->expects($this->any())->method('checkLOA')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$returned = $client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$this->assertInstanceOf('edu\wisc\doit\RpcNetidStructValidationResponse', $returned );
$this->assertFalse( $returned->getIsValid() );
}
/**
* @test throws exception if web service returns 403 (No LOA found for UID)
* @expectedException edu\wisc\doit\RpcNetidClientSoapException
* @expectedExceptionCode 100
* @test returns false if web service returns 403 (No LOA found for UID)
*/
function checkLOA_403_throws() {
function checkLOA_403_returns_false() {
$result = new stdClass();
$result->result = 403;
$this->mockSoapClient->expects($this->any())->method('checkLOA')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$returned = $client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$this->assertInstanceOf('edu\wisc\doit\RpcNetidStructValidationResponse', $returned );
$this->assertFalse( $returned->getIsValid() );
}
/**
* @test throws exception if web service returns 404 (No Wiscard eligibility found for user)
* @expectedException edu\wisc\doit\RpcNetidClientSoapException
* @expectedExceptionCode 100
* @test returns false if web service returns 404 (No Wiscard eligibility found for user)
*/
function checkLOA_404_throws() {
function checkLOA_404_returns_false() {
$result = new stdClass();
$result->result = 404;
$this->mockSoapClient->expects($this->any())->method('checkLOA')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$returned = $client->checkLOA( "jsmith", new \DateTime(), 12345678901 );
$this->assertInstanceOf('edu\wisc\doit\RpcNetidStructValidationResponse', $returned );
$this->assertFalse( $returned->getIsValid() );
}
......
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