} } } } ///############### RUN TESTS include_once '../JustGivingClient.php'; include_once 'TestContext.php'; $testContext = new TestContext(); $client = new JustGivingClient($testContext->ApiLocation, $testContext->ApiKey, $testContext->ApiVersion, $testContext->TestUsername, $testContext->TestValidPassword); $client->debug = $testContext->Debug; function WriteLine($string) { echo $string . "<br/>"; } echo "<h1>Executing Test Cases</h1>"; $pageTests = new AccountApiTests(); $pageTests->Create_WhenSuppliedWithValidNewAccountDetails_CreatesAccount($client); $pageTests->ListAllPages_WhenSuppliedWithAValidAccount_RetrievesPages($client); $pageTests->IsEmailRegistered_WhenSuppliedEmailUnlikelyToExist_ReturnsFalse($client); $pageTests->IsEmailRegistered_WhenSuppliedKnownEmail_ReturnsTrue($client, $testContext->TestUsername); $pageTests->IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsValid($client, $testContext->TestUsername, $testContext->TestValidPassword); $pageTests->IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsInValid($client, $testContext->TestUsername, $testContext->TestInvalidPassword); $pageTests->GetAccountDetails_WhenSuppliedAuthentication_RetriveAccountDetails($client); $pageTests->ChangeAccountPassword_WhenSuppliedCorrectCurrentPasswordAndNewPassword_ReturnSuccess_True($client, $testContext->TestUsername, $testContext->TestValidPassword); $pageTests->ChangeAccountPassword_WhenSuppliedInCorrectCurrentPasswordAndNewPassword_ReturnSuccess_False($client, $testContext->TestUsername, $testContext->TestInvalidPassword); $pageTests->GetAllDonations_WhenSuppliedAuthentication_ReturnListOfDonations($client); $pageTests->GetRatingHistory_WhenSuppliedAuthentication_ReturnListOfRatings($client); $pageTests->RateContent_WhenSuppliedAuthenticationAndProperRate_Return_True($client); $pageTests->GetContentFeed_WhenSuppliedAuthenticatio_ReturnFeed($client); $pageTests->AddInterest_WhenSuppliedAuthenticationAndProperName_Return_True($client); $pageTests->ReplaceInterest_WhenSuppliedAuthenticationAndCorrectListOfInterest_Return_True($client);
echo "<hr />"; echo "<b>IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsInValid</b><br /><br />"; $request = new ValidateAccountRequest(); $request->email = $knownEmail; $request->password = $knownPassword; $response = $client->Account->IsValid($request); if ($response->customerId == 0 && $response->IsValid == 0) { WriteLine("Account credentials are incorrect or accound doesn't exist - TEST PASSED"); } else { WriteLine("Account credentials are correct - TEST FAILED"); } } } ///############### RUN TESTS include_once '../JustGivingClient.php'; include_once 'TestContext.php'; $testContext = new TestContext(); $client = new JustGivingClient($testContext->ApiLocation, $testContext->ApiKey, $testContext->ApiVersion, $testContext->TestUsername, $testContext->TestValidPassword); $client->debug = $testContext->Debug; function WriteLine($string) { echo $string . "<br/>"; } echo "<h1>Executing Test Cases</h1>"; $pageTests = new AccountApiTests(); $pageTests->Create_WhenSuppliedWithValidNewAccountDetails_CreatesAccount($client); $pageTests->ListAllPages_WhenSuppliedWithAValidAccount_RetrievesPages($client); $pageTests->IsEmailRegistered_WhenSuppliedEmailUnlikelyToExist_ReturnsFalse($client); $pageTests->IsEmailRegistered_WhenSuppliedKnownEmail_ReturnsTrue($client, $testContext->TestUsername); $pageTests->IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsValid($client, $testContext->TestUsername, $testContext->TestValidPassword); $pageTests->IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsInValid($client, $testContext->TestUsername, $testContext->TestInvalidPassword);