20
20
use NXP \Exception \UnknownVariableException ;
21
21
use NXP \MathExecutor ;
22
22
use PHPUnit \Framework \TestCase ;
23
+ use PHPUnit \Framework \Attributes \DataProvider ;
23
24
24
25
class MathTest extends TestCase
25
26
{
26
- /**
27
- * @dataProvider providerExpressions
28
- */
27
+ #[DataProvider('providerExpressions ' )]
29
28
public function testCalculating (string $ expression ) : void
30
29
{
31
30
$ calculator = new MathExecutor ();
@@ -269,9 +268,7 @@ public static function providerExpressions()
269
268
];
270
269
}
271
270
272
- /**
273
- * @dataProvider bcMathExpressions
274
- */
271
+ #[DataProvider('bcMathExpressions ' )]
275
272
public function testBCMathCalculating (string $ expression , string $ expected = '' ) : void
276
273
{
277
274
$ calculator = new MathExecutor ();
@@ -515,9 +512,7 @@ public static function bcMathExpressions()
515
512
];
516
513
}
517
514
518
- /**
519
- * @dataProvider incorrectExpressions
520
- */
515
+ #[DataProvider('incorrectExpressions ' )]
521
516
public function testIncorrectExpressionException (string $ expression ) : void
522
517
{
523
518
$ calculator = new MathExecutor ();
@@ -976,7 +971,7 @@ public function testNullReturnType() : void
976
971
public function testGetFunctionsReturnsArray () : void
977
972
{
978
973
$ calculator = new MathExecutor ();
979
- $ this ->assertIsArray ($ calculator ->getFunctions ());
974
+ $ this ->assertIsArray ($ calculator ->getFunctions ()); // @phpstan-ignore-line
980
975
}
981
976
982
977
public function testGetFunctionsReturnsFunctions () : void
@@ -988,7 +983,7 @@ public function testGetFunctionsReturnsFunctions() : void
988
983
public function testGetVarsReturnsArray () : void
989
984
{
990
985
$ calculator = new MathExecutor ();
991
- $ this ->assertIsArray ($ calculator ->getVars ());
986
+ $ this ->assertIsArray ($ calculator ->getVars ()); // @phpstan-ignore-line
992
987
}
993
988
994
989
public function testGetVarsReturnsCount () : void
@@ -1098,9 +1093,7 @@ public function testVarExists() : void
1098
1093
$ this ->assertFalse ($ calculator ->varExists ('Lucy ' ));
1099
1094
}
1100
1095
1101
- /**
1102
- * @dataProvider providerExpressionValues
1103
- */
1096
+ #[DataProvider('providerExpressionValues ' )]
1104
1097
public function testCalculatingValues (string $ expression , mixed $ value ) : void
1105
1098
{
1106
1099
$ calculator = new MathExecutor ();
@@ -1160,7 +1153,7 @@ public function testCache() : void
1160
1153
$ calculator = new MathExecutor ();
1161
1154
$ this ->assertEquals (256 , $ calculator ->execute ('2 ^ 8 ' )); // second arg $cache is true by default
1162
1155
1163
- $ this ->assertIsArray ($ calculator ->getCache ());
1156
+ $ this ->assertIsArray ($ calculator ->getCache ()); // @phpstan-ignore-line
1164
1157
$ this ->assertCount (1 , $ calculator ->getCache ());
1165
1158
1166
1159
$ this ->assertEquals (512 , $ calculator ->execute ('2 ^ 9 ' , true ));
@@ -1179,7 +1172,7 @@ public function testCache() : void
1179
1172
1180
1173
public function testUnsupportedOperands () : void
1181
1174
{
1182
- if (\version_compare (PHP_VERSION , '8 ' ) >= 0 ) {
1175
+ if (\version_compare (PHP_VERSION , '8.0 ' ) >= 0 ) { // @phpstan-ignore-line
1183
1176
$ calculator = new MathExecutor ();
1184
1177
1185
1178
$ calculator ->setVar ('stringVar ' , 'string ' );
0 commit comments