forked from nsbucky/echosignv3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseUrisTest.php
54 lines (39 loc) · 1.61 KB
/
BaseUrisTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
use Echosign\BaseUris;
use GuzzleHttp\Message\Response;
use GuzzleHttp\Stream\Stream;
use GuzzleHttp\Subscriber\Mock;
class BaseUrisTest extends PHPUnit_Framework_TestCase
{
/*
public function testApiRequestUrl()
{
$transport = new \Echosign\Transports\GuzzleTransport();
$baseUris = new BaseUris( '12345', $transport );
$url = $baseUris->getRequestUrl();
$expectedUrl = $baseUris->getApiEndPoint() . '/' . $baseUris->getBaseApiPath();
$this->assertEquals( $expectedUrl, $url );
$url = $baseUris->getRequestUrl( [ 'test' => 'baz' ] );
$this->assertEquals( $expectedUrl . '?test=baz', $url );
}*/
public function testGetBaseUris()
{
$transport = new \Echosign\Transports\GuzzleTransport();
$client = $transport->getClient();
// mock the request
$json = [
"api_access_point" => "https://api.echosign.com",
"web_access_point" => "https://secure.echosign.com"
];
$stream = Stream::factory( json_encode( $json ) );
$mock = new Mock( [
new Response( 200, [ 'content-type' => 'application/json' ], $stream )
] );
$client->getEmitter()->attach( $mock );
$baseUris = new BaseUris( '12345', $transport );
$baseUriInfo = $baseUris->getBaseUris();
$this->assertInstanceOf( 'Echosign\Responses\BaseUriInfo', $baseUriInfo );
$this->assertEquals( $json["api_access_point"], $baseUriInfo->getApiAccessPoint() );
$this->assertEquals( $json["web_access_point"], $baseUriInfo->getWebAccessPoint() );
}
}