Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485015
CoinbaseMocksTrait.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
886 B
Referenced Files
None
Subscribers
None
CoinbaseMocksTrait.php
View Options
<?php
namespace
Tests
;
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 \GuzzleHttp\Handler\MockHandler
*/
public
function
mockCoinbase
()
{
$handler
=
HandlerStack
::
create
(
$mockHandler
=
new
MockHandler
()
);
$handler
->
push
(
Middleware
::
history
(
$this
->
coinbaseRequestHistory
)
);
\App\Providers\Payment\Coinbase
::
$testClient
=
new
Client
([
'handler'
=>
$handler
]);
return
$mockHandler
;
}
public
function
unmockCoinbase
()
{
\App\Providers\Payment\Coinbase
::
$testClient
=
null
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 20, 5:28 PM (22 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387253
Default Alt Text
CoinbaseMocksTrait.php (886 B)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment