Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117751359
CoinbaseMocksTrait.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
856 B
Referenced Files
None
Subscribers
None
CoinbaseMocksTrait.php
View Options
<?php
namespace
Tests
;
use
App\Providers\Payment\Coinbase
;
use
GuzzleHttp\Client
;
use
GuzzleHttp\Handler\MockHandler
;
use
GuzzleHttp\HandlerStack
;
use
GuzzleHttp\Middleware
;
trait
CoinbaseMocksTrait
{
public
$coinbaseRequestHistory
=
[];
/**
* Make Coinbase's Guzzle instance use a mock handler.
*
* @see http://docs.guzzlephp.org/en/stable/testing.html
*
* @return MockHandler
*/
public
function
mockCoinbase
()
{
$handler
=
HandlerStack
::
create
(
$mockHandler
=
new
MockHandler
()
);
$handler
->
push
(
Middleware
::
history
(
$this
->
coinbaseRequestHistory
)
);
Coinbase
::
$testClient
=
new
Client
([
'handler'
=>
$handler
]);
return
$mockHandler
;
}
public
function
unmockCoinbase
()
{
Coinbase
::
$testClient
=
null
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Apr 4, 3:04 AM (3 d, 16 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821626
Default Alt Text
CoinbaseMocksTrait.php (856 B)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline