Skip to content

Commit

Permalink
Whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Sep 7, 2018
1 parent 0040919 commit ef641b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/API/Helpers/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ public function __construct(array $config)
/**
* Magic method to overload method calls to paths.
*
* @param string $name Method invoked.
* @param array|null $arguments Arguments to add to the path.
* @param string $name Method invoked.
* @param array|null $arguments Arguments to add to the path.
*
* @return RequestBuilder
*/
Expand Down Expand Up @@ -401,7 +401,7 @@ public function withDictParams($params)
*/
public function setReturnType($type)
{
if ( empty( $type ) ) {
if (empty( $type )) {
$type = 'body';
}

Expand Down
6 changes: 3 additions & 3 deletions src/API/Management.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ class Management
/**
* Management constructor.
*
* @param string $token
* @param string $domain
* @param array $guzzleOptions
* @param string $token
* @param string $domain
* @param array $guzzleOptions
* @param string|null $returnType
*/
public function __construct($token, $domain, $guzzleOptions = [], $returnType = null)
Expand Down
18 changes: 10 additions & 8 deletions tests/RequestBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,29 @@ public function testgGetGuzzleOptionsWithBasePath()
/**
* Test that the return type is set properly and returns the correct result.
*/
public function testReturnType() {
$env = self::getEnvStatic();
$token = self::getTokenStatic($env, ['tenant_settings' => ['actions' => ['read']]]);
public function testReturnType()
{
$env = self::getEnvStatic();
$token = self::getTokenStatic($env, ['tenant_settings' => ['actions' => ['read']]]);

// Test default return type matches "body".
$api = new Management($token, $env['DOMAIN'], []);
$api = new Management($token, $env['DOMAIN'], []);
$results_default = $api->tenants->get();
$this->assertTrue( is_array( $results_default ) );

$api = new Management($token, $env['DOMAIN'], [], 'body');
$api = new Management($token, $env['DOMAIN'], [], 'body');
$results_body = $api->tenants->get();
$this->assertEquals( $results_default, $results_body );

// Test that "headers" return type contains expected keys.
$api = new Management($token, $env['DOMAIN'], [], 'headers');
$api = new Management($token, $env['DOMAIN'], [], 'headers');
$results_headers = $api->tenants->get();
$this->assertArrayHasKey( 'x-ratelimit-limit', $results_headers );
$this->assertArrayHasKey( 'x-ratelimit-remaining', $results_headers );
$this->assertArrayHasKey( 'x-ratelimit-reset', $results_headers );

// Test that "object" return type returns the correct object type.
$api = new Management($token, $env['DOMAIN'], [], 'object');
$api = new Management($token, $env['DOMAIN'], [], 'object');
$results_object = $api->tenants->get();
$this->assertInstanceOf( 'GuzzleHttp\Psr7\Response', $results_object );

Expand All @@ -145,9 +146,10 @@ public function testReturnType() {
try {
$api = new Management($token, $env['DOMAIN'], [], '__invalid_return_type__');
$api->tenants->get();
} catch ( CoreException $e ) {
} catch (CoreException $e) {
$caught_return_type_error = $this->errorHasString( $e, 'Invalid returnType' );
}

$this->assertTrue( $caught_return_type_error );
}
}

0 comments on commit ef641b0

Please sign in to comment.