Skip to content

Commit 79cef67

Browse files
authored
Merge pull request #388 from stloyd/chore/phpunit-10
chore: Upgrade PHPUnit to 10.5
2 parents c29ec39 + 5c1757d commit 79cef67

File tree

22 files changed

+1030
-1154
lines changed

22 files changed

+1030
-1154
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
*.cache
3-
var
3+
var
4+
./phpunit.xml
File renamed without changes.

src/calendar/tests/Aeon/Calculator/Tests/Unit/BCMathCalculatorTest.php

Lines changed: 71 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,15 @@
66

77
use Aeon\Calculator\BCMathCalculator;
88
use Aeon\Calculator\Exception\InvalidTypeException;
9+
use PHPUnit\Framework\Attributes\DataProvider;
910
use PHPUnit\Framework\TestCase;
1011

1112
final class BCMathCalculatorTest extends TestCase
1213
{
13-
/**
14-
* @dataProvider add_data_provider
15-
*/
16-
public function test_add(string $result, float $value, float $nextValue) : void
17-
{
18-
$this->assertSame($result, (new BCMathCalculator(6))->add(\number_format($value, 9), \number_format($nextValue, 9)));
19-
}
20-
2114
/**
2215
* @return \Generator<int, array{string, float, float}, mixed, void>
2316
*/
24-
public function add_data_provider() : \Generator
17+
public static function add_data_provider() : \Generator
2518
{
2619
yield ['3.000000', 2.0, 1.0];
2720
yield ['3.000000', 2, 1];
@@ -32,18 +25,10 @@ public function add_data_provider() : \Generator
3225
yield ['0.000000', 0.000_000_49, 0.000_000_1];
3326
}
3427

35-
/**
36-
* @dataProvider sub_provider
37-
*/
38-
public function test_sub(string $result, float $value, float $nextValue) : void
39-
{
40-
$this->assertSame($result, (new BCMathCalculator(6))->sub(\number_format($value, 9), \number_format($nextValue, 9)));
41-
}
42-
4328
/**
4429
* @return \Generator<int, array{string, float, float}, mixed, void>
4530
*/
46-
public function sub_provider() : \Generator
31+
public static function sub_provider() : \Generator
4732
{
4833
yield ['1.000000', 2.0, 1.0];
4934
yield ['1.000000', 2, 1];
@@ -53,18 +38,10 @@ public function sub_provider() : \Generator
5338
yield ['0.000000', 0.000_000_49, 0.000_000_1];
5439
}
5540

56-
/**
57-
* @dataProvider multiply_provider
58-
*/
59-
public function test_multiply(string $result, float $value, float $nextValue) : void
60-
{
61-
$this->assertSame($result, (new BCMathCalculator(6))->multiply(\number_format($value, 9), \number_format($nextValue, 9)));
62-
}
63-
6441
/**
6542
* @return \Generator<int, array{string, float, float}, mixed, void>
6643
*/
67-
public function multiply_provider() : \Generator
44+
public static function multiply_provider() : \Generator
6845
{
6946
yield ['2.000000', 2.0, 1.0];
7047
yield ['2.000000', 2, 1];
@@ -74,18 +51,10 @@ public function multiply_provider() : \Generator
7451
yield ['0.000000', 0.000_000_49, 0.000_000_1];
7552
}
7653

77-
/**
78-
* @dataProvider divide_provider
79-
*/
80-
public function test_divide(string $result, float $value, float $nextValue) : void
81-
{
82-
$this->assertSame($result, (new BCMathCalculator(6))->divide(\number_format($value, 9), \number_format($nextValue, 9)));
83-
}
84-
8554
/**
8655
* @return \Generator<int, array{string, float, float}, mixed, void>
8756
*/
88-
public function divide_provider() : \Generator
57+
public static function divide_provider() : \Generator
8958
{
9059
yield ['1.000000', 1.0, 1.0];
9160
yield ['2.000000', 2, 1];
@@ -95,18 +64,10 @@ public function divide_provider() : \Generator
9564
yield ['4.900000', 0.000_000_49, 0.000_000_1];
9665
}
9766

98-
/**
99-
* @dataProvider modulo_provider
100-
*/
101-
public function test_modulo(string $result, float $value, float $nextValue) : void
102-
{
103-
$this->assertSame($result, (new BCMathCalculator(6))->modulo(\number_format($value, 9), \number_format($nextValue, 9)));
104-
}
105-
10667
/**
10768
* @return \Generator<int, array{string, float, float}, mixed, void>
10869
*/
109-
public function modulo_provider() : \Generator
70+
public static function modulo_provider() : \Generator
11071
{
11172
yield ['0.000000', 1.0, 1.0];
11273
yield ['0.000000', 2, 1];
@@ -118,18 +79,10 @@ public function modulo_provider() : \Generator
11879
yield ['0.000000', 0.000_000_49, 0.000_000_1];
11980
}
12081

121-
/**
122-
* @dataProvider is_equal_data_provider
123-
*/
124-
public function test_is_equal(bool $equal, float $value, float $nextValue) : void
125-
{
126-
$this->assertSame($equal, (new BCMathCalculator(6))->isEqualTo(\number_format($value, 9), \number_format($nextValue, 9)));
127-
}
128-
12982
/**
13083
* @return \Generator<int, array{bool, float, float}, mixed, void>
13184
*/
132-
public function is_equal_data_provider() : \Generator
85+
public static function is_equal_data_provider() : \Generator
13386
{
13487
yield [false, 2.0, 1.0];
13588
yield [false, 2, 1];
@@ -139,37 +92,21 @@ public function is_equal_data_provider() : \Generator
13992
yield [true, 0.000_000_49, 0.000_000_1];
14093
}
14194

142-
/**
143-
* @dataProvider is_less_data_provider
144-
*/
145-
public function test_is_less(bool $equal, float $value, float $nextValue) : void
146-
{
147-
$this->assertSame($equal, (new BCMathCalculator(6))->isLessThan(\number_format($value, 8), \number_format($nextValue, 8)));
148-
}
149-
15095
/**
15196
* @return \Generator<int, array{bool, float, float}, mixed, void>
15297
*/
153-
public function is_less_data_provider() : \Generator
98+
public static function is_less_data_provider() : \Generator
15499
{
155100
yield [false, 2.0, 1.0];
156101
yield [false, 2, 1];
157102
yield [false, 0.000_000, 0.000_000_1];
158103
yield [false, 0.000_000_49, 0.000_000_10];
159104
}
160105

161-
/**
162-
* @dataProvider is_greater_data_provider
163-
*/
164-
public function test_is_greater(bool $equal, float $value, float $nextValue) : void
165-
{
166-
$this->assertSame($equal, (new BCMathCalculator(6))->isGreaterThan(\number_format($value, 9), \number_format($nextValue, 9)));
167-
}
168-
169106
/**
170107
* @return \Generator<int, array{bool, float, float}, mixed, void>
171108
*/
172-
public function is_greater_data_provider() : \Generator
109+
public static function is_greater_data_provider() : \Generator
173110
{
174111
yield [true, 2.0, 1.0];
175112
yield [true, 2, 1];
@@ -178,37 +115,21 @@ public function is_greater_data_provider() : \Generator
178115
yield [false, 0.000_000_1, 0.000_000_51];
179116
}
180117

181-
/**
182-
* @dataProvider is_greater_than_eq_data_provider
183-
*/
184-
public function test_is_greater_than_eq(bool $equal, float $value, float $nextValue) : void
185-
{
186-
$this->assertSame($equal, (new BCMathCalculator(6))->isGreaterThanOrEqualTo(\number_format($value, 9), \number_format($nextValue, 9)));
187-
}
188-
189118
/**
190119
* @return \Generator<int, array{bool, float, float}, mixed, void>
191120
*/
192-
public function is_greater_than_eq_data_provider() : \Generator
121+
public static function is_greater_than_eq_data_provider() : \Generator
193122
{
194123
yield [true, 2.0, 1.0];
195124
yield [true, 2, 1];
196125
yield [true, 0.000_000, 0.000_000_1];
197126
yield [true, 0.000_000_49, 0.000_000_1];
198127
}
199128

200-
/**
201-
* @dataProvider is_less_than_eq_data_provider
202-
*/
203-
public function test_is_less_than_eq(bool $equal, float $value, float $nextValue) : void
204-
{
205-
$this->assertSame($equal, (new BCMathCalculator(6))->isLessThanOrEqualTo(\number_format($value, 9), \number_format($nextValue, 9)));
206-
}
207-
208129
/**
209130
* @return \Generator<int, array{bool, float, float}, mixed, void>
210131
*/
211-
public function is_less_than_eq_data_provider() : \Generator
132+
public static function is_less_than_eq_data_provider() : \Generator
212133
{
213134
yield [false, 2.0, 1.0];
214135
yield [false, 2, 1];
@@ -217,6 +138,66 @@ public function is_less_than_eq_data_provider() : \Generator
217138
yield [true, 0.000_000_1, 0.000_000_51];
218139
}
219140

141+
#[DataProvider('add_data_provider')]
142+
public function test_add(string $result, float $value, float $nextValue) : void
143+
{
144+
$this->assertSame($result, (new BCMathCalculator(6))->add(\number_format($value, 9), \number_format($nextValue, 9)));
145+
}
146+
147+
#[DataProvider('sub_provider')]
148+
public function test_sub(string $result, float $value, float $nextValue) : void
149+
{
150+
$this->assertSame($result, (new BCMathCalculator(6))->sub(\number_format($value, 9), \number_format($nextValue, 9)));
151+
}
152+
153+
#[DataProvider('multiply_provider')]
154+
public function test_multiply(string $result, float $value, float $nextValue) : void
155+
{
156+
$this->assertSame($result, (new BCMathCalculator(6))->multiply(\number_format($value, 9), \number_format($nextValue, 9)));
157+
}
158+
159+
#[DataProvider('divide_provider')]
160+
public function test_divide(string $result, float $value, float $nextValue) : void
161+
{
162+
$this->assertSame($result, (new BCMathCalculator(6))->divide(\number_format($value, 9), \number_format($nextValue, 9)));
163+
}
164+
165+
#[DataProvider('modulo_provider')]
166+
public function test_modulo(string $result, float $value, float $nextValue) : void
167+
{
168+
$this->assertSame($result, (new BCMathCalculator(6))->modulo(\number_format($value, 9), \number_format($nextValue, 9)));
169+
}
170+
171+
#[DataProvider('is_equal_data_provider')]
172+
public function test_is_equal(bool $equal, float $value, float $nextValue) : void
173+
{
174+
$this->assertSame($equal, (new BCMathCalculator(6))->isEqualTo(\number_format($value, 9), \number_format($nextValue, 9)));
175+
}
176+
177+
#[DataProvider('is_less_data_provider')]
178+
public function test_is_less(bool $equal, float $value, float $nextValue) : void
179+
{
180+
$this->assertSame($equal, (new BCMathCalculator(6))->isLessThan(\number_format($value, 8), \number_format($nextValue, 8)));
181+
}
182+
183+
#[DataProvider('is_greater_data_provider')]
184+
public function test_is_greater(bool $equal, float $value, float $nextValue) : void
185+
{
186+
$this->assertSame($equal, (new BCMathCalculator(6))->isGreaterThan(\number_format($value, 9), \number_format($nextValue, 9)));
187+
}
188+
189+
#[DataProvider('is_greater_than_eq_data_provider')]
190+
public function test_is_greater_than_eq(bool $equal, float $value, float $nextValue) : void
191+
{
192+
$this->assertSame($equal, (new BCMathCalculator(6))->isGreaterThanOrEqualTo(\number_format($value, 9), \number_format($nextValue, 9)));
193+
}
194+
195+
#[DataProvider('is_less_than_eq_data_provider')]
196+
public function test_is_less_than_eq(bool $equal, float $value, float $nextValue) : void
197+
{
198+
$this->assertSame($equal, (new BCMathCalculator(6))->isLessThanOrEqualTo(\number_format($value, 9), \number_format($nextValue, 9)));
199+
}
200+
220201
public function test_invalid_value_in_divide() : void
221202
{
222203
$this->expectException(InvalidTypeException::class);

0 commit comments

Comments
 (0)