Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
BaseContextFactory example
$result
=
$this
->
createMock
(
Result::
class
)
;
$result
->
expects
(
static
::
once
(
)
)
->
method
(
'fetchOne'
)
->
willReturn
(
$fetchParentLanguageResult
)
;
$connection
->
expects
(
static
::
once
(
)
)
->
method
(
'executeQuery'
)
->
willReturn
(
$result
)
;
$connection
->
expects
(
static
::
atMost
(
1
)
)
->
method
(
'createQueryBuilder'
)
->
willReturn
(
new
QueryBuilder
(
$connection
)
)
;
}
else
{
$result
=
$this
->
createMock
(
Result::
class
)
;
$result
->
expects
(
static
::
atMost
(
1
)
)
->
method
(
'fetchOne'
)
->
willReturn
(
false
)
;
$connection
->
expects
(
static
::
atMost
(
1
)
)
->
method
(
'executeQuery'
)
->
willReturn
(
$result
)
;
$connection
->
expects
(
static
::
atMost
(
1
)
)
->
method
(
'createQueryBuilder'
)
->
willReturn
(
new
QueryBuilder
(
$connection
)
)
;
}
$factory
=
new
BaseContextFactory
(
$salesChannelRepository
,
$currencyRepository
,
$customerGroupRepository
,
$countryRepository
,
$taxRepository
,
$paymentMethodRepository
,
$shippingMethodRepository
,
$connection
,
$countryStateRepository
,
$currencyCountryRepository
)
;