1 | <?php |
||
2 | /* |
||
3 | * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
||
4 | * |
||
5 | * Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics) |
||
6 | * |
||
7 | * This program is free software: you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU Affero General Public License as published |
||
9 | * by the Free Software Foundation, either version 3 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | * |
||
12 | * This program is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | * GNU Affero General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU Affero General Public License |
||
18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
19 | */ |
||
20 | |||
21 | declare(strict_types=1); |
||
22 | |||
23 | /** |
||
24 | * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
||
25 | * |
||
26 | * Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics) |
||
27 | * |
||
28 | * This program is free software: you can redistribute it and/or modify |
||
29 | * it under the terms of the GNU Affero General Public License as published |
||
30 | * by the Free Software Foundation, either version 3 of the License, or |
||
31 | * (at your option) any later version. |
||
32 | * |
||
33 | * This program is distributed in the hope that it will be useful, |
||
34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
36 | * GNU Affero General Public License for more details. |
||
37 | * |
||
38 | * You should have received a copy of the GNU Affero General Public License |
||
39 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
40 | */ |
||
41 | |||
42 | namespace App\Tests\Entity\Parameters; |
||
43 | |||
44 | use App\Entity\Parameters\PartParameter; |
||
45 | use PHPUnit\Framework\TestCase; |
||
0 ignored issues
–
show
|
|||
46 | |||
47 | class PartParameterTest extends TestCase |
||
48 | { |
||
49 | public function valueWithUnitDataProvider(): array |
||
50 | { |
||
51 | return [ |
||
52 | ['1', 1.0, ''], |
||
53 | ['1 V', 1.0, 'V'], |
||
54 | ['1.23', 1.23, ''], |
||
55 | ['1.23 V', 1.23, 'V'], |
||
56 | ]; |
||
57 | } |
||
58 | |||
59 | public function formattedValueDataProvider(): array |
||
60 | { |
||
61 | return [ |
||
62 | ['Text Test', null, null, null, 'V', 'Text Test'], |
||
63 | ['10.23 V', null, 10.23, null, 'V', ''], |
||
64 | ['10.23 V [Text]', null, 10.23, null, 'V', 'Text'], |
||
65 | ['max. 10.23 V', null, null, 10.23, 'V', ''], |
||
66 | ['max. 10.23 [Text]', null, null, 10.23, '', 'Text'], |
||
67 | ['min. 10.23 V', 10.23, null, null, 'V', ''], |
||
68 | ['10.23 V ... 11 V', 10.23, null, 11, 'V', ''], |
||
69 | ['10.23 V (9 V ... 11 V)', 9, 10.23, 11, 'V', ''], |
||
70 | ['10.23 V (9 V ... 11 V) [Test]', 9, 10.23, 11, 'V', 'Test'], |
||
71 | ]; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @dataProvider valueWithUnitDataProvider |
||
76 | */ |
||
77 | public function testGetValueMinWithUnit(string $expected, float $value, string $unit): void |
||
78 | { |
||
79 | $param = new PartParameter(); |
||
80 | $param->setUnit($unit); |
||
81 | $param->setValueMin($value); |
||
82 | $this->assertSame($expected, $param->getValueMinWithUnit()); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @dataProvider valueWithUnitDataProvider |
||
87 | */ |
||
88 | public function testGetValueMaxWithUnit(string $expected, float $value, string $unit): void |
||
89 | { |
||
90 | $param = new PartParameter(); |
||
91 | $param->setUnit($unit); |
||
92 | $param->setValueMax($value); |
||
93 | $this->assertSame($expected, $param->getValueMaxWithUnit()); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @dataProvider valueWithUnitDataProvider |
||
98 | */ |
||
99 | public function testGetValueTypicalWithUnit(string $expected, float $value, string $unit): void |
||
100 | { |
||
101 | $param = new PartParameter(); |
||
102 | $param->setUnit($unit); |
||
103 | $param->setValueTypical($value); |
||
104 | $this->assertSame($expected, $param->getValueTypicalWithUnit()); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @dataProvider formattedValueDataProvider |
||
109 | * |
||
110 | * @param float $min |
||
111 | * @param float $typical |
||
112 | * @param float $max |
||
113 | */ |
||
114 | public function testGetFormattedValue(string $expected, ?float $min, ?float $typical, ?float $max, string $unit, string $text): void |
||
115 | { |
||
116 | $param = new PartParameter(); |
||
117 | $param->setUnit($unit); |
||
118 | $param->setValueMin($min); |
||
119 | $param->setValueTypical($typical); |
||
120 | $param->setValueMax($max); |
||
121 | $param->setValueText($text); |
||
122 | $this->assertSame($expected, $param->getFormattedValue()); |
||
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