Passed
Push — 6.5.0.0 ( 1a0673...8c3841 )
by Christian
36:39 queued 22:05
created

TaxFixtures::getTaxSeventeenPointOnePercent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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;
0 ignored issues
show
Bug introduced by
The type Shopware\Core\System\Tax\TaxEntity was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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