Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
TaxProviderDefinition example
->
method
(
'getContext'
)
->
willReturn
(
$context
)
;
$cart
=
new
Cart
(
$this
->ids->
get
(
'cart'
)
)
;
$source
=
new
Source
(
'https://shopware.com',
$this
->ids->
get
(
'shop-id'
)
, '1.0.0'
)
;
$payload
=
new
TaxProviderPayload
(
$cart
,
$salesChannelContext
)
;
$payload
->
setSource
(
$source
)
;
$definitionInstanceRegistry
=
static
::
createMock
(
DefinitionInstanceRegistry::
class
)
;
$definitionInstanceRegistry
->
method
(
'getByEntityClass'
)
->
willReturn
(
new
TaxProviderDefinition
(
)
)
;
$entityEncoder
=
new
JsonEntityEncoder
(
new
Serializer
(
[
new
StructNormalizer
(
)
]
,
[
new
JsonEncoder
(
)
]
)
)
;
$appPayloadServiceHelper
=
new
AppPayloadServiceHelper
(
$definitionInstanceRegistry
,
$entityEncoder
,
static
::
createMock
(
ShopIdProvider::
class
)
)
;
protected
function
setUp
(
)
: void
{
$this
->ids =
new
IdsCollection
(
)
;
}
public
function
testRequest
(
)
: void
{
$definitionInstanceRegistry
=
static
::
createMock
(
DefinitionInstanceRegistry::
class
)
;
$definitionInstanceRegistry
->
method
(
'getByEntityClass'
)
->
willReturn
(
new
TaxProviderDefinition
(
)
)
;
$shopIdProvider
=
static
::
createMock
(
ShopIdProvider::
class
)
;
$shopIdProvider
->
method
(
'getShopId'
)
->
willReturn
(
$this
->ids->
get
(
'shop-id'
)
)
;
$entityEncoder
=
new
JsonEntityEncoder
(
new
Serializer
(
[
new
StructNormalizer
(
)
]
,
[
new
JsonEncoder
(
)
]
)
)
;
$appPayloadServiceHelper
=
new
AppPayloadServiceHelper
(