예제 #1
0
파일: crm.php 프로젝트: aurearias/sgfcrm
    {
        echo "<hr />";
        echo "<b>paymentListWithDates</b><br/><br/>";
        $response = $client->Charity->paymentsListWithDates(183731, "2015-05-20", "2015-05-29");
        echo '<pre>';
        print_r($response);
        echo '</pre><p>';
        foreach ($response as $key => $object) {
            echo "Date: " . $object->PaymentDate . "Ref: " . $object->PaymentRef . "<br/>";
        }
        $paymentRefData = array("Mike", "John", "Jane", "Sam");
        echo '<pre>';
        print_r($paymentRefData);
        echo '</pre><p>';
    }
}
///############### RUN TESTS
include_once '../JustGivingClient.php';
include_once 'TestContextCRM.php';
require_once 'rollbar.php';
Rollbar::init(array('environment' => 'production'));
$testContextCRM = new TestContextCRM();
$client = new JustGivingClient($testContextCRM->ApiLocation, $testContextCRM->ApiKey, $testContextCRM->ApiVersion, $testContextCRM->TestUsername, $testContextCRM->TestValidPassword);
$client->debug = $testContextCRM->Debug;
function WriteLine($string)
{
    echo $string . "<br/>";
}
echo "<h1>Executing...</h1>";
$tests = new CharityApiTests();
$tests->paymentListWithDates($client);
예제 #2
0
<?php

set_time_limit(0);
include_once '../lib/ApiClients/Model/CreateAccountRequest.php';
class CharityApiTests
{
    function Retrieve_WhenSuppliedWithValidCharityId_RetrievesCharity($client)
    {
        echo "<hr />";
        echo "<b>Retrieve_WhenSuppliedWithValidCharityId_RetrievesCharity</b><br/><br/>";
        $response = $client->Charity->Retrieve(2050);
        WriteLine("Charity Name: " . $response->name);
    }
}
///############### RUN TESTS
include_once '../lib/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>";
$tests = new CharityApiTests();
$tests->Retrieve_WhenSuppliedWithValidCharityId_RetrievesCharity($client);
    }
    function GetCategories_ReturnCategories($client)
    {
        echo "<hr />";
        echo "<b>GetCategories_ReturnCategories</b><br/>";
        $response = $client->Charity->Categories();
        if ($response != null) {
            WriteLine("TEST PASSED");
        } else {
            WriteLine("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>";
$tests = new CharityApiTests();
$tests->Retrieve_WhenSuppliedWithValidCharityId_RetrievesCharity($client);
$tests->RetriveAccount_WhenSuppliedCorrectRequest_ReturnValid($client);
$tests->RetriveAccount_WhenSuppliedInCorrectRequest_ReturnInValid($client);
$tests->GetEventsByCharityId_WhenSuppliedCorrectCharityId_ReturnEvents($client);
$tests->GetDonations_WhenSuppliedCorrectCharityId_ReturnDonations($client);
$tests->GetCategories_ReturnCategories($client);