1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Core\System\Test; |
4
|
|
|
|
5
|
|
|
use Shopware\Core\Framework\Uuid\Uuid; |
6
|
|
|
use Shopware\Core\System\Tax\TaxEntity; |
|
|
|
|
7
|
|
|
use Shopware\Core\Test\TestDefaults; |
8
|
|
|
|
9
|
|
|
trait TaxFixtures |
10
|
|
|
{ |
11
|
|
|
use EntityFixturesBase; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @var array<string, mixed> |
15
|
|
|
*/ |
16
|
|
|
public $taxFixtures; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @before |
20
|
|
|
*/ |
21
|
|
|
public function initializeTaxFixtures(): void |
22
|
|
|
{ |
23
|
|
|
$this->taxFixtures = [ |
24
|
|
|
'NineteenPercentTax' => [ |
25
|
|
|
'id' => Uuid::randomHex(), |
26
|
|
|
'name' => 'NineteenPercentTax', |
27
|
|
|
'taxRate' => 19, |
28
|
|
|
], |
29
|
|
|
'NineteenPercentTaxWithAreaRule' => [ |
30
|
|
|
'id' => Uuid::randomHex(), |
31
|
|
|
'name' => 'foo tax', |
32
|
|
|
'taxRate' => 20, |
33
|
|
|
'areaRules' => [ |
34
|
|
|
[ |
35
|
|
|
'id' => Uuid::randomHex(), |
36
|
|
|
'taxRate' => 99, |
37
|
|
|
'active' => true, |
38
|
|
|
'name' => 'required', |
39
|
|
|
'customerGroupId' => TestDefaults::FALLBACK_CUSTOMER_GROUP, |
40
|
|
|
], |
41
|
|
|
], |
42
|
|
|
], |
43
|
|
|
'SeventeenPointOnePercentTax' => [ |
44
|
|
|
'id' => Uuid::randomHex(), |
45
|
|
|
'name' => 'SeventeenPointOnePercentTax', |
46
|
|
|
'taxRate' => 17.1, |
47
|
|
|
'areaRules' => [ |
48
|
|
|
[ |
49
|
|
|
'id' => Uuid::randomHex(), |
50
|
|
|
'taxRate' => 17.1, |
51
|
|
|
'active' => true, |
52
|
|
|
'name' => 'required', |
53
|
|
|
'customerGroupId' => TestDefaults::FALLBACK_CUSTOMER_GROUP, |
54
|
|
|
], |
55
|
|
|
], |
56
|
|
|
], |
57
|
|
|
'NinePointSevenFourPercentTax' => [ |
58
|
|
|
'id' => Uuid::randomHex(), |
59
|
|
|
'name' => 'NinePointSevenFourPercentTax', |
60
|
|
|
'taxRate' => 9.74, |
61
|
|
|
'areaRules' => [ |
62
|
|
|
[ |
63
|
|
|
'id' => Uuid::randomHex(), |
64
|
|
|
'taxRate' => 9.74, |
65
|
|
|
'active' => true, |
66
|
|
|
'name' => 'required', |
67
|
|
|
'customerGroupId' => TestDefaults::FALLBACK_CUSTOMER_GROUP, |
68
|
|
|
], |
69
|
|
|
], |
70
|
|
|
], |
71
|
|
|
'ThirteenPointFourEightSixPercentTax' => [ |
72
|
|
|
'id' => Uuid::randomHex(), |
73
|
|
|
'name' => 'ThirteenPointFourEightSixPercentTax', |
74
|
|
|
'taxRate' => 13.486, |
75
|
|
|
'areaRules' => [ |
76
|
|
|
[ |
77
|
|
|
'id' => Uuid::randomHex(), |
78
|
|
|
'taxRate' => 13.486, |
79
|
|
|
'active' => true, |
80
|
|
|
'name' => 'required', |
81
|
|
|
'customerGroupId' => TestDefaults::FALLBACK_CUSTOMER_GROUP, |
82
|
|
|
], |
83
|
|
|
], |
84
|
|
|
], |
85
|
|
|
]; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getTaxNineteenPercent(): TaxEntity |
89
|
|
|
{ |
90
|
|
|
return $this->getTaxFixture('NineteenPercentTax'); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getTaxSeventeenPointOnePercent(): TaxEntity |
94
|
|
|
{ |
95
|
|
|
return $this->getTaxFixture('SeventeenPointOnePercentTax'); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getTaxNinePointSevenFourPercent(): TaxEntity |
99
|
|
|
{ |
100
|
|
|
return $this->getTaxFixture('NinePointSevenFourPercentTax'); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getTaxThirteenPointFourEightSixPercent(): TaxEntity |
104
|
|
|
{ |
105
|
|
|
return $this->getTaxFixture('ThirteenPointFourEightSixPercentTax'); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getTaxNineteenPercentWithAreaRule(): TaxEntity |
109
|
|
|
{ |
110
|
|
|
return $this->getTaxFixture('NineteenPercentTaxWithAreaRule'); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
private function getTaxFixture(string $fixtureName): TaxEntity |
114
|
|
|
{ |
115
|
|
|
/** @var TaxEntity $taxEntity */ |
116
|
|
|
$taxEntity = $this->createFixture( |
117
|
|
|
$fixtureName, |
118
|
|
|
$this->taxFixtures, |
119
|
|
|
self::getFixtureRepository('tax') |
120
|
|
|
); |
121
|
|
|
|
122
|
|
|
return $taxEntity; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths