Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
mockBrowserTestBaseWithDriver example
$expected
=
new
\
stdClass
(
)
;
$browserkit_client
=
$this
->
getMockBuilder
(
DrupalTestBrowser::
class
)
->
onlyMethods
(
[
'getClient'
]
)
->
getMockForAbstractClass
(
)
;
$browserkit_client
->
expects
(
$this
->
once
(
)
)
->
method
(
'getClient'
)
->
willReturn
(
$expected
)
;
// Because the driver is a BrowserKitDriver, we'll get back a client.
$driver
=
new
BrowserKitDriver
(
$browserkit_client
)
;
$btb
=
$this
->
mockBrowserTestBaseWithDriver
(
$driver
)
;
$ref_gethttpclient
=
new
\
ReflectionMethod
(
$btb
, 'getHttpClient'
)
;
$this
->
assertSame
(
get_class
(
$expected
)
,
get_class
(
$ref_gethttpclient
->
invoke
(
$btb
)
)
)
;
}
/** * @covers ::getHttpClient */
public
function
testGetHttpClientException
(
)
{
// A driver type that isn't BrowserKitDriver. This should cause a