Skip to content

Commit

Permalink
Closes #3342
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 25, 2019
1 parent ef8e524 commit e470a3a
Showing 1 changed file with 12 additions and 53 deletions.
65 changes: 12 additions & 53 deletions src/Framework/Assert.php
Expand Up @@ -327,32 +327,14 @@ public static function assertNotCount(int $expectedCount, $haystack, string $mes
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
public static function assertEquals($expected, $actual, string $message = ''): void
{
// @codeCoverageIgnoreStart
if ($delta !== 0.0) {
self::createWarning('The optional $delta parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsWithDelta() instead.');
}

if ($maxDepth !== 10) {
self::createWarning('The optional $maxDepth parameter of assertEquals() is deprecated and will be removed in PHPUnit 9.');
}

if ($canonicalize) {
self::createWarning('The optional $canonicalize parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsCanonicalizing() instead.');
}

if ($ignoreCase) {
self::createWarning('The optional $ignoreCase parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsIgnoringCase() instead.');
}
// @codeCoverageIgnoreEnd

$constraint = new IsEqual(
$expected,
$delta,
$maxDepth,
$canonicalize,
$ignoreCase
0.0,
10,
false,
false
);

static::assertThat($actual, $constraint, $message);
Expand Down Expand Up @@ -415,41 +397,18 @@ public static function assertEqualsWithDelta($expected, $actual, float $delta, s
/**
* Asserts that two variables are not equal.
*
* @param float $delta
* @param int $maxDepth
* @param bool $canonicalize
* @param bool $ignoreCase
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertNotEquals($expected, $actual, string $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false): void
public static function assertNotEquals($expected, $actual, string $message = ''): void
{
// @codeCoverageIgnoreStart
if ($delta !== 0.0) {
self::createWarning('The optional $delta parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotEqualsWithDelta() instead.');
}

if ($maxDepth !== 10) {
self::createWarning('The optional $maxDepth parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9.');
}

if ($canonicalize) {
self::createWarning('The optional $canonicalize parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotEqualsCanonicalizing() instead.');
}

if ($ignoreCase) {
self::createWarning('The optional $ignoreCase parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotEqualsIgnoringCase() instead.');
}
// @codeCoverageIgnoreEnd

$constraint = new LogicalNot(
new IsEqual(
$expected,
$delta,
$maxDepth,
$canonicalize,
$ignoreCase
0.0,
10,
false,
false
)
);

Expand Down Expand Up @@ -2560,9 +2519,9 @@ public static function arrayHasKey($key): ArrayHasKey
return new ArrayHasKey($key);
}

public static function equalTo($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): IsEqual
public static function equalTo($value): IsEqual
{
return new IsEqual($value, $delta, $maxDepth, $canonicalize, $ignoreCase);
return new IsEqual($value, 0.0, 10, false, false);
}

public static function isEmpty(): IsEmpty
Expand Down

0 comments on commit e470a3a

Please sign in to comment.