예제 #1
0
 public function testPrepareService()
 {
     $client = new TestApiClient();
     $service = $client->prepareService();
     $this->assertEquals("", $service['scope']);
     $client->setScopes(array("scope1", "scope2"));
     $service = $client->prepareService();
     $this->assertEquals("scope1 scope2", $service['scope']);
     $client->setScopes(array("", "scope2"));
     $service = $client->prepareService();
     $this->assertEquals(" scope2", $service['scope']);
     $client->setClientId('test1');
     $client->setRedirectUri('http://localhost/');
     $client->setScopes(array("http://test.com", "scope2"));
     $service = $client->prepareService();
     $this->assertEquals("http://test.com scope2", $service['scope']);
     $this->assertEquals('' . 'https://accounts.google.com/o/oauth2/auth' . '?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%2F' . '&client_id=test1' . '&scope=http%3A%2F%2Ftest.com+scope2&access_type=offline' . '&approval_prompt=force', $client->createAuthUrl());
 }
예제 #2
0
<?php

require_once dirname(__FILE__) . "/../../TestApiClient.class.php";
require_once dirname(__FILE__) . "/../config.php";
$client = new TestApiClient(INVIPAY_API_URL, INVIPAY_API_KEY, INVIPAY_SIGNATURE_KEY, INVIPAY_PARTNER_API_KEY, INVIPAY_PARTNER_SIGNATURE_KEY);
Logger::info('Calling getDate method of TestApiClient');
$result = $client->getDate();
Logger::info('Result is: {0}', $result);
print_separator();
Logger::info('Calling whoAmI method of TestApiClient');
$result = $client->whoAmI();
Logger::info('Result is: {0}', $result);
print_separator();
Logger::info('Calling echoMessage method of TestApiClient');
$result = $client->echoMessage(new EchoIn('Hello world', true));
Logger::info('Result is: {0}', $result);
print_separator();