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

Added integration tests for checkLOA. Some don't pass because of data

issues in Test. I'm considering the checkLOA method to be correct.
parent a76e1b4e
No related branches found
No related tags found
No related merge requests found
...@@ -175,7 +175,7 @@ class RpcNetidClientSoap implements RpcNetidClient { ...@@ -175,7 +175,7 @@ class RpcNetidClientSoap implements RpcNetidClient {
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE ); RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE );
break; break;
case 404: case 404:
throw new RpcNetidClientSoapException("no Wiscard eligibility data found for uid", throw new RpcNetidClientSoapException("Web service returned 404: no Wiscard eligibility data found for uid",
RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE ); RpcNetidClientSoapException::UNEXPECTED_STATUS_CODE );
break; break;
case 405: case 405:
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
use edu\wisc\doit\RpcNetidClientSoapConfig; use edu\wisc\doit\RpcNetidClientSoapConfig;
use edu\wisc\doit\RpcNetidClientSoap; use edu\wisc\doit\RpcNetidClientSoap;
use edu\wisc\doit\RpcNetidStructQuestion; use edu\wisc\doit\RpcNetidStructQuestion;
use edu\wisc\doit\RpcNetidStructValidationResponse;
/** /**
* Integration tests for edu\wisc\doit\RpcNetidClientSoap * Integration tests for edu\wisc\doit\RpcNetidClientSoap
...@@ -77,30 +78,49 @@ class RpcNetidClientSoapIT extends PHPUnit_Framework_TestCase { ...@@ -77,30 +78,49 @@ class RpcNetidClientSoapIT extends PHPUnit_Framework_TestCase {
} }
/** @test */ /** @test */
public function credentialCheck_validIT() { public function checkLOA_Loa2valid() {
$result = self::$client->credentialCheck( $result = self::$client->checkLOA(
self::$testData['user']['uid'], self::$testData['user']['uid'],
new DateTime( self::$testData['user']['birthdate'] ), new DateTime( self::$testData['user']['birthdate'] ),
intval( self::$testData['user']['wiscard'] ) ); intval( self::$testData['user']['wiscard'] ) );
$this->assertTrue( $result ); $this->assertTrue( $result->getIsValid() );
} }
/** @test test valid credentials for an LOA1 NetID (NetID and DOB only) */ /** @test test valid credentials for an LOA1 NetID (NetID and DOB only) */
public function credentialCheck_Loa1Valid() { public function checkLOA_Loa1Valid() {
$result = self::$client->credentialCheck( $result = self::$client->checkLOA(
self::$testData['loa1-user']['uid'], self::$testData['loa1-user']['uid'],
new DateTime( self::$testData['loa1-user']['birthdate'] ) new DateTime( self::$testData['loa1-user']['birthdate'] )
); );
$this->assertTrue( $result ); $this->assertTrue( $result->getIsValid() );
} }
/** @test */ /** @test */
public function credentialCheck_invalidIT() { public function checkLOA_invalid() {
$result = self::$client->credentialCheck( $result = self::$client->checkLOA(
self::$testData['invalid-user']['uid'], self::$testData['invalid-user']['uid'],
new DateTime( self::$testData['invalid-user']['birthdate'] ), new DateTime( self::$testData['invalid-user']['birthdate'] ),
intval( self::$testData['invalid-user']['wiscard'] ) ); intval( self::$testData['invalid-user']['wiscard'] ) );
$this->assertFalse( $result ); $this->assertFalse( $result->getIsValid() );
}
/** @test Returns invalid if LOA2 and no wiscard provided */
public function checkLOA_Loa2_no_wiscard() {
$result = self::$client->checkLOA(
self::$testData['user']['uid'],
new DateTime( self::$testData['user']['birthdate'] ) );
$this->assertFalse( $result->getIsValid() );
$this->assertContains( RpcNetidStructValidationResponse::REASON_NEEDS_WISCARD, $result->getReasons() );
}
/** @test returns valid if LOA1 enters wiscard even if one doesn't exist */
public function checkLOA_loa1_with_wiscard_returns_valid() {
$result = self::$client->checkLOA(
self::$testData['loa1-user']['uid'],
new DateTime( self::$testData['loa1-user']['birthdate'] ),
intval( 12345678901 )
);
$this->assertTrue( $result->getIsValid() );
} }
/** @test */ /** @test */
......
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