Skip to content

Commit

Permalink
Upgrade to PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Aug 1, 2023
1 parent aa12196 commit cc40da9
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/vendor
/composer.lock
/.phpunit.result.cache
/.phpunit.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^10.0",
"php-coveralls/php-coveralls": "^2.2",
"vimeo/psalm": "5.14.1"
},
Expand Down
8 changes: 4 additions & 4 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="phpunit.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="phpunit.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Math tests">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
<directory>src</directory>
</include>
</coverage>
</source>
</phpunit>
76 changes: 38 additions & 38 deletions tests/BigDecimalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testOf($value, string $unscaledValue, int $scale) : void
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($value));
}

public function providerOf() : array
public static function providerOf() : array
{
return [
[0, '0', 0],
Expand Down Expand Up @@ -206,7 +206,7 @@ public function testOfFloatInDifferentLocales(string $locale) : void
setlocale(LC_NUMERIC, $originalLocale);
}

public function providerOfFloatInDifferentLocales() : array
public static function providerOfFloatInDifferentLocales() : array
{
return [
['C'],
Expand All @@ -231,7 +231,7 @@ public function testOfInvalidValueThrowsException($value) : void
BigDecimal::of($value);
}

public function providerOfInvalidValueThrowsException() : array
public static function providerOfInvalidValueThrowsException() : array
{
return [
[''],
Expand Down Expand Up @@ -282,7 +282,7 @@ public function testOfUnscaledValue($unscaledValue, int $scale, string $expected
self::assertBigDecimalInternalValues($expectedUnscaledValue, $scale, $number);
}

public function providerOfUnscaledValue() : array
public static function providerOfUnscaledValue() : array
{
return [
[123456789, 0, '123456789'],
Expand Down Expand Up @@ -347,7 +347,7 @@ public function testMin(array $values, string $min) : void
self::assertBigDecimalEquals($min, BigDecimal::min(... $values));
}

public function providerMin() : array
public static function providerMin() : array
{
return [
[[0, 1, -1], '-1'],
Expand Down Expand Up @@ -388,7 +388,7 @@ public function testMax(array $values, string $max) : void
self::assertBigDecimalEquals($max, BigDecimal::max(... $values));
}

public function providerMax() : array
public static function providerMax() : array
{
return [
[[0, 0.9, -1.00], '0.9'],
Expand Down Expand Up @@ -433,7 +433,7 @@ public function testSum(array $values, string $sum) : void
self::assertBigDecimalEquals($sum, BigDecimal::sum(... $values));
}

public function providerSum() : array
public static function providerSum() : array
{
return [
[[0, 0.9, -1.00], '-0.1'],
Expand Down Expand Up @@ -480,7 +480,7 @@ public function testPlus(string $a, string $b, string $unscaledValue, int $scale
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($a)->plus($b));
}

public function providerPlus() : array
public static function providerPlus() : array
{
return [
['123', '999', '1122', 0],
Expand Down Expand Up @@ -556,7 +556,7 @@ public function testMinus(string $a, string $b, string $unscaledValue, int $scal
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($a)->minus($b));
}

public function providerMinus() : array
public static function providerMinus() : array
{
return [
['123', '999', '-876', 0],
Expand Down Expand Up @@ -625,7 +625,7 @@ public function testMultipliedBy(string $a, string $b, string $unscaledValue, in
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($a)->multipliedBy($b));
}

public function providerMultipliedBy() : array
public static function providerMultipliedBy() : array
{
return [
['123', '999', '122877', 0],
Expand Down Expand Up @@ -739,7 +739,7 @@ public function testDividedBy(string $a, string $b, ?int $scale, int $roundingMo
self::assertBigDecimalInternalValues($unscaledValue, $expectedScale, $decimal);
}

public function providerDividedBy() : array
public static function providerDividedBy() : array
{
return [
[ '7', '0.2', 0, RoundingMode::UNNECESSARY, '35', 0],
Expand Down Expand Up @@ -774,7 +774,7 @@ public function testDividedByByZeroThrowsException($zero) : void
BigDecimal::of(1)->dividedBy($zero, 0);
}

public function providerDividedByByZeroThrowsException() : array
public static function providerDividedByByZeroThrowsException() : array
{
return [
[0],
Expand Down Expand Up @@ -807,7 +807,7 @@ public function testExactlyDividedBy($number, $divisor, string $expected) : void
}
}

public function providerExactlyDividedBy() : array
public static function providerExactlyDividedBy() : array
{
return [
[1, 1, '1'],
Expand Down Expand Up @@ -860,7 +860,7 @@ public function testDividedByWithRoundingNecessaryThrowsException(string $a, str
BigDecimal::of($a)->dividedBy($b, $scale);
}

public function providerDividedByWithRoundingNecessaryThrowsException() : array
public static function providerDividedByWithRoundingNecessaryThrowsException() : array
{
return [
['1.234', '123.456', 3],
Expand Down Expand Up @@ -921,7 +921,7 @@ private function doTestRoundingMode(int $roundingMode, BigDecimal $number, strin
}
}

public function providerRoundingMode() : array
public static function providerRoundingMode() : array
{
return [
[RoundingMode::UP, '3.501', '351', '36', '4'],
Expand Down Expand Up @@ -1407,7 +1407,7 @@ public function testQuotientAndRemainder(string $dividend, string $divisor, stri
self::assertBigDecimalEquals($remainder, $r);
}

public function providerQuotientAndRemainder() : array
public static function providerQuotientAndRemainder() : array
{
return [
['1', '123', '0', '1'],
Expand Down Expand Up @@ -1504,7 +1504,7 @@ public function testSqrt(string $number, int $scale, string $sqrt) : void
self::assertBigDecimalEquals($sqrt, $number->sqrt($scale));
}

public function providerSqrt() : array
public static function providerSqrt() : array
{
return [
['0', 0, '0'],
Expand Down Expand Up @@ -1728,7 +1728,7 @@ public function testPower(string $number, int $exponent, string $unscaledValue,
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($number)->power($exponent));
}

public function providerPower() : array
public static function providerPower() : array
{
return [
['-3', 0, '1', 0],
Expand Down Expand Up @@ -1788,7 +1788,7 @@ public function testPowerWithInvalidExponentThrowsException(int $power) : void
BigDecimal::of(1)->power($power);
}

public function providerPowerWithInvalidExponentThrowsException() : array
public static function providerPowerWithInvalidExponentThrowsException() : array
{
return [
[-1],
Expand All @@ -1797,7 +1797,7 @@ public function providerPowerWithInvalidExponentThrowsException() : array
}

/**
* @dataProvider toScaleProvider
* @dataProvider providerToScale
*
* @param string $number The number to scale.
* @param int $toScale The scale to apply.
Expand All @@ -1811,7 +1811,7 @@ public function testToScale(string $number, int $toScale, int $roundingMode, str
self::assertBigDecimalInternalValues($unscaledValue, $scale, $decimal);
}

public function toScaleProvider() : array
public static function providerToScale() : array
{
return [
['123.45', 0, RoundingMode::DOWN, '123', 0],
Expand All @@ -1833,7 +1833,7 @@ public function testWithPointMovedLeft(string $number, int $places, string $expe
self::assertBigDecimalEquals($expected, BigDecimal::of($number)->withPointMovedLeft($places));
}

public function providerWithPointMovedLeft() : array
public static function providerWithPointMovedLeft() : array
{
return [
['0', -2, '0'],
Expand Down Expand Up @@ -1916,7 +1916,7 @@ public function testWithPointMovedRight(string $number, int $places, string $exp
self::assertBigDecimalEquals($expected, BigDecimal::of($number)->withPointMovedRight($places));
}

public function providerWithPointMovedRight() : array
public static function providerWithPointMovedRight() : array
{
return [
['0', -2, '0.00'],
Expand Down Expand Up @@ -1998,7 +1998,7 @@ public function testStripTrailingZeros(string $number, string $expected) : void
self::assertBigDecimalEquals($expected, BigDecimal::of($number)->stripTrailingZeros());
}

public function providerStripTrailingZeros() : array
public static function providerStripTrailingZeros() : array
{
return [
['0', '0'],
Expand Down Expand Up @@ -2044,7 +2044,7 @@ public function testAbs(string $number, string $unscaledValue, int $scale) : voi
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($number)->abs());
}

public function providerAbs() : array
public static function providerAbs() : array
{
return [
['123', '123', 0],
Expand All @@ -2066,7 +2066,7 @@ public function testNegated(string $number, string $unscaledValue, int $scale) :
self::assertBigDecimalInternalValues($unscaledValue, $scale, BigDecimal::of($number)->negated());
}

public function providerNegated() : array
public static function providerNegated() : array
{
return [
['123', '-123', 0],
Expand Down Expand Up @@ -2148,7 +2148,7 @@ public function testIsGreaterThanOrEqualTo(string $a, $b, int $c) : void
self::assertSame($c >= 0, BigDecimal::of($a)->isGreaterThanOrEqualTo($b));
}

public function providerCompareTo() : array
public static function providerCompareTo() : array
{
return [
['123', '123', 0],
Expand Down Expand Up @@ -2263,7 +2263,7 @@ public function testIsPositiveOrZero($number, int $sign) : void
self::assertSame($sign >= 0, BigDecimal::of($number)->isPositiveOrZero());
}

public function providerSign() : array
public static function providerSign() : array
{
return [
[ 0, 0],
Expand Down Expand Up @@ -2307,7 +2307,7 @@ public function testGetIntegralPart(string $number, string $expected) : void
self::assertSame($expected, BigDecimal::of($number)->getIntegralPart());
}

public function providerGetIntegralPart() : array
public static function providerGetIntegralPart() : array
{
return [
['1.23', '1'],
Expand All @@ -2331,7 +2331,7 @@ public function testGetFractionalPart(string $number, string $expected) : void
self::assertSame($expected, BigDecimal::of($number)->getFractionalPart());
}

public function providerGetFractionalPart() : array
public static function providerGetFractionalPart() : array
{
return [
['1.23', '23'],
Expand All @@ -2354,7 +2354,7 @@ public function testHasNonZeroFractionalPart(string $number, bool $hasNonZeroFra
self::assertSame($hasNonZeroFractionalPart, BigDecimal::of($number)->hasNonZeroFractionalPart());
}

public function providerHasNonZeroFractionalPart() : array
public static function providerHasNonZeroFractionalPart() : array
{
return [
['1', false],
Expand All @@ -2377,7 +2377,7 @@ public function testToBigInteger(string $decimal, string $expected) : void
self::assertBigIntegerEquals($expected, BigDecimal::of($decimal)->toBigInteger());
}

public function providerToBigInteger() : array
public static function providerToBigInteger() : array
{
return [
['0', '0'],
Expand All @@ -2399,7 +2399,7 @@ public function testToBigIntegerThrowsExceptionWhenRoundingNecessary(string $dec
BigDecimal::of($decimal)->toBigInteger();
}

public function providerToBigIntegerThrowsExceptionWhenRoundingNecessary() : array
public static function providerToBigIntegerThrowsExceptionWhenRoundingNecessary() : array
{
return [
['0.1'],
Expand All @@ -2425,7 +2425,7 @@ public function testToBigRational(string $decimal, string $rational) : void
self::assertBigRationalEquals($rational, BigDecimal::of($decimal)->toBigRational());
}

public function providerToBigRational() : array
public static function providerToBigRational() : array
{
return [
['0', '0'],
Expand Down Expand Up @@ -2469,7 +2469,7 @@ public function testToInt(int $number) : void
self::assertSame($number, BigDecimal::of($number . '.0')->toInt());
}

public function providerToInt() : array
public static function providerToInt() : array
{
return [
[PHP_INT_MIN],
Expand All @@ -2493,7 +2493,7 @@ public function testToIntThrowsException(string $number) : void
BigDecimal::of($number)->toInt();
}

public function providerToIntThrowsException() : array
public static function providerToIntThrowsException() : array
{
return [
['-999999999999999999999999999999'],
Expand All @@ -2514,7 +2514,7 @@ public function testToFloat(string $value, float $float) : void
self::assertSame($float, BigDecimal::of($value)->toFloat());
}

public function providerToFloat() : array
public static function providerToFloat() : array
{
return [
['0', 0.0],
Expand All @@ -2539,7 +2539,7 @@ public function testToString(string $unscaledValue, int $scale, string $expected
self::assertSame($expected, (string) BigDecimal::ofUnscaledValue($unscaledValue, $scale));
}

public function providerToString() : array
public static function providerToString() : array
{
return [
['0', 0, '0'],
Expand Down
Loading

0 comments on commit cc40da9

Please sign in to comment.