Skip to content
Snippets Groups Projects
Commit ce3efd3b authored by Matt Trefilek's avatar Matt Trefilek
Browse files

Updating to new phpunit version

parent 4680dca9
No related branches found
No related tags found
1 merge request!2Updating to new phpunit version and added uid argument for passwordChoicePolicyCheck
......@@ -21,4 +21,7 @@
/src/test/resources/pemtest.pem
/src/test/resources/integration-test-data.ini
.DS_Store
\ No newline at end of file
.DS_Store
*.iml
.idea
\ No newline at end of file
......@@ -81,7 +81,7 @@
<!-- Updates phpunit -->
<target name="update-phpunit" depends="get-phpunit" >
<exec command="php phpunit.phar --self-update" passthru="true" checkreturn="true" />
<exec command="php phpunit.phar" passthru="true" checkreturn="true" />
</target>
<!-- Creates a release -->
......
......@@ -77,7 +77,7 @@ interface RpcNetidClient {
* @param string $password the password
* @return RpcNetidStructValidationResponse indicates if valid and the reason for invalid
*/
function passwordChoicePolicyCheck( $password );
function passwordChoicePolicyCheck( $uid, $password );
/**
* Verifies the identity of a UW-Madison user using his or her NetID, date of birth,
......
......@@ -285,12 +285,12 @@ class RpcNetidClientSoap implements RpcNetidClient {
* (non-PHPdoc)
* @see \edu\wisc\doit\RpcNetidClient::passwordChoicePolicyCheck()
*/
public function passwordChoicePolicyCheck( $password ){
public function passwordChoicePolicyCheck( $uid, $password ){
if(is_string($password) !== true){
throw new \DomainException("password parameter must be a string");
}
$result = $this->getSoapClient()->passwordChoicePolicyCheck( array('password' => $password) );
$result = $this->getSoapClient()->passwordChoicePolicyCheck( array('uid' => $uid, 'password' => $password) );
if( $result->result === 200){
return new RpcNetidStructValidationResponse(true, array() );
......
......@@ -2,13 +2,15 @@
use edu\wisc\doit\CertificateService;
require_once 'vendor/Autoload.php';
/**
* Unit tests for the edu\wisc\doit\CertificateService class.
*
* These tests rely on self-signed certificates in the /src/test/resources folder.
*/
class CertificateServiceTest extends PHPUnit_Framework_TestCase {
class CertificateServiceTest extends PHPUnit\Framework\TestCase {
private $cert;
private $key;
......
......@@ -17,7 +17,7 @@ use edu\wisc\doit\RpcNetidStructValidationResponse;
* @see https://phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubbing-and-mocking-web-services PHPUnit: Stubbing and Mocking Web Services
*/
class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
class RpcNetidClientSoapTest extends PHPUnit\Framework\TestCase {
private $config;
private $cert;
......@@ -488,7 +488,7 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
$this->mockSoapClient->expects($this->any())->method('passwordChoicePolicyCheck')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$returnValue = $client->passwordChoicePolicyCheck("password");
$returnValue = $client->passwordChoicePolicyCheck("uid", "password");
$this->assertFalse($returnValue->getIsValid());
$this->assertEquals($result->Reasons->Reason, $returnValue->getReasons());
......@@ -507,7 +507,7 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
$result->Reasons->Reason = array( "Invalid Arguments" );
$this->mockSoapClient->expects($this->any())->method('passwordChoicePolicyCheck')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$returnValue = $client->passwordChoicePolicyCheck("password");
$returnValue = $client->passwordChoicePolicyCheck("uid", "password");
$this->assertFalse($returnValue->getIsValid());
$this->assertEquals($result->Reasons->Reason, $returnValue->getReasons());
......@@ -524,7 +524,7 @@ class RpcNetidClientSoapTest extends PHPUnit_Framework_TestCase {
$this->mockSoapClient->expects($this->any())->method('passwordChoicePolicyCheck')->will($this->returnValue($result));
$client = new RpcNetidClientSoap($this->mockSoapClient);
$returnValue = $client->passwordChoicePolicyCheck("password");
$returnValue = $client->passwordChoicePolicyCheck("uid", "password");
$this->assertTrue($returnValue->getIsValid());
......
......@@ -18,7 +18,7 @@ use edu\wisc\doit\RpcNetidStructValidationResponse;
*
*/
class RpcNetidClientSoapIT extends PHPUnit_Framework_TestCase {
class RpcNetidClientSoapIT extends PHPUnit\Framework\TestCase {
/** @var array */
private static $testData = false;
......@@ -249,13 +249,13 @@ class RpcNetidClientSoapIT extends PHPUnit_Framework_TestCase {
/** @test */
public function passwordChoicePolicyCheck_validPassword() {
$result = self::$client->passwordChoicePolicyCheck( self::$testData['user']['password'] );
$result = self::$client->passwordChoicePolicyCheck(self::$testData['user']['uid'], self::$testData['user']['password'] );
$this->assertTrue( $result->getIsValid() );
}
/** @test */
public function passwordChoicePolicyCheck_invalidPassword() {
$result = self::$client->passwordChoicePolicyCheck( self::$testData['invalid-user']['password'] );
$result = self::$client->passwordChoicePolicyCheck( self::$testData['invalid-user']['uid'], self::$testData['invalid-user']['password'] );
$this->assertFalse( $result->getIsValid() );
$this->assertNotEmpty( $result->getReasons() );
}
......
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