Skip to content

Commit

Permalink
Update HasHttpRequestTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue authored Aug 10, 2018
1 parent 98e0ce3 commit 4d10444
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/Traits/HasHttpRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ public function testGetBaseOptions()

$this->assertSame('http://mock-uri', $object->getBaseOptions()['base_uri']);
$this->assertSame(5.0, $object->getBaseOptions()['timeout']);

// timeout overwrite
$object = \Mockery::mock(DummyTimeoutClassForHasHttpRequestTrait::class)
->makePartial()
->shouldAllowMockingProtectedMethods();
$object->allows()->getBaseOptions(anyArgs())->passthru();

$this->assertSame('http://mock-uri', $object->getBaseOptions()['base_uri']);
$this->assertSame(30.0, $object->getBaseOptions()['timeout']);
}

public function testUnwrapResponseWithJsonResponse()
Expand Down Expand Up @@ -132,3 +141,17 @@ public function getBaseUri()
return 'http://mock-uri';
}
}

class DummyTimeoutClassForHasHttpRequestTrait
{
use HasHttpRequest;

public function getBaseUri()
{
return 'http://mock-uri';
}

public function getTimeout() {
return 30.0;
}
}

0 comments on commit 4d10444

Please sign in to comment.