Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setApp example
$cart
=
$this
->
createCart
(
)
;
$salesChannelContext
=
static
::
createMock
(
SalesChannelContext::
class
)
;
$salesChannelContext
->
method
(
'getTotalRounding'
)
->
willReturn
(
new
CashRoundingConfig
(
2, 0.01, true
)
)
;
$taxProvider
=
new
TaxProviderEntity
(
)
;
$taxProvider
->
setId
(
Uuid::
randomHex
(
)
)
;
$taxProvider
->
setActive
(
true
)
;
$taxProvider
->
setPriority
(
1
)
;
$taxProvider
->
setIdentifier
(
TestConstantTaxRateProvider::
class
)
;
$taxProvider
->
setApp
(
new
AppEntity
(
)
)
;
$taxProvider
->
setProcessUrl
(
'https://example.com'
)
;
$collection
=
new
TaxProviderCollection
(
[
$taxProvider
]
)
;
$result
=
new
EntitySearchResult
(
TaxProviderDefinition::ENTITY_NAME,
1,
$collection
,
null,
new
Criteria
(
)
,
Context::
createDefaultContext
(
)
)
;
$appEntity
->
setId
(
Uuid::
randomHex
(
)
)
;
$appEntity
->
setName
(
'Cool App'
)
;
$appEntity
->
setAclRoleId
(
Uuid::
randomHex
(
)
)
;
$appEntity
->
setActive
(
true
)
;
$appEntity
->
setVersion
(
'0.0.0'
)
;
$appEntity
->
setAppSecret
(
'verysecret'
)
;
$webhookEntity
=
new
WebhookEntity
(
)
;
$webhookEntity
->
setId
(
Uuid::
randomHex
(
)
)
;
$webhookEntity
->
setName
(
'Cool Webhook'
)
;
$webhookEntity
->
setEventName
(
$eventName
)
;
$webhookEntity
->
setApp
(
$appEntity
)
;
$webhookEntity
->
setUrl
(
'https://foo.bar'
)
;
return
$webhookEntity
;
}
private
function
prepareContainer
(
WebhookEntity
$webhookEntity
)
: void
{
$shopIdProvider
=
$this
->
createMock
(
ShopIdProvider::
class
)
;
$shopIdProvider
->
expects
(
static
::
once
(
)
)
->
method
(
'getShopId'
)
->
willReturn
(
'foobar'
)
;
$this
->container->
set
(
'webhook.repository',
new
StaticEntityRepository
(
[
new
WebhookCollection
(
[
$webhookEntity
]
)
]
)
)
;
return
$orderTransaction
;
}
$paymentMethod
=
clone
$paymentMethod
;
$orderTransaction
->
setPaymentMethod
(
$paymentMethod
)
;
$appPaymentMethod
=
$paymentMethod
->
getAppPaymentMethod
(
)
;
if
(
$appPaymentMethod
=== null
)
{
return
$orderTransaction
;
}
$appPaymentMethod
=
clone
$appPaymentMethod
;
$appPaymentMethod
->
setApp
(
null
)
;
$paymentMethod
->
setAppPaymentMethod
(
$appPaymentMethod
)
;
return
$orderTransaction
;
}
}