Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCustomerTax example
$tax
=
new
TaxEntity
(
)
;
$tax
->
setId
(
'4926035368e34d9fa695e017d7a231b9'
)
;
$tax
->
setName
(
'test'
)
;
$tax
->
setTaxRate
(
19.0
)
;
$taxes
=
new
TaxCollection
(
[
$tax
]
)
;
}
if
(
!
$country
)
{
$country
=
new
CountryEntity
(
)
;
$country
->
setId
(
'5cff02b1029741a4891c430bcd9e3603'
)
;
$country
->
setCustomerTax
(
new
TaxFreeConfig
(
false, Defaults::CURRENCY, 0
)
)
;
$country
->
setCompanyTax
(
new
TaxFreeConfig
(
false, Defaults::CURRENCY, 0
)
)
;
$country
->
setName
(
'Germany'
)
;
}
if
(
!
$state
)
{
$state
=
new
CountryStateEntity
(
)
;
$state
->
setId
(
'bd5e2dcf547e4df6bb1ff58a554bc69e'
)
;
$state
->
setCountryId
(
$country
->
getId
(
)
)
;
}
if
(
!
$shipping
)
{
$shipping
=
new
CustomerAddressEntity
(
)
;
$detector
=
$this
->
getContainer
(
)
->
get
(
TaxDetector::
class
)
;
static
::
assertFalse
(
$detector
->
useGross
(
$context
)
)
;
}
public
function
testIsNetDelivery
(
)
: void
{
$context
=
$this
->
createMock
(
SalesChannelContext::
class
)
;
$country
=
new
CountryEntity
(
)
;
$country
->
setCustomerTax
(
new
TaxFreeConfig
(
true, Defaults::CURRENCY, 0
)
)
;
$country
->
setCompanyTax
(
new
TaxFreeConfig
(
true, Defaults::CURRENCY, 0
)
)
;
$context
->
expects
(
static
::
once
(
)
)
->
method
(
'getShippingLocation'
)
->
willReturn
(
ShippingLocation::
createFromCountry
(
$country
)
)
;
$detector
=
$this
->
getContainer
(
)
->
get
(
TaxDetector::
class
)
;
static
::
assertTrue
(
$detector
->
isNetDelivery
(
$context
)
)
;
}
public
function
testIsNetDeliveryWithCompanyFreeTax
(
)
: void
{