Skip to content

Commit

Permalink
Closes #3951
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 25, 2019
1 parent 50ad7e1 commit 3c1e5ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 72 deletions.
1 change: 1 addition & 0 deletions ChangeLog-9.0.md
Expand Up @@ -17,6 +17,7 @@ All notable changes of the PHPUnit 9.0 release series are documented in this fil
* Implemented [#3370](https://github.com/sebastianbergmann/phpunit/issues/3370): Remove `assertInternalType()` and `assertNotInternalType()`
* Implemented [#3426](https://github.com/sebastianbergmann/phpunit/issues/3426): Clean up `assertContains()` and `assertNotContains()`
* Implemented [#3495](https://github.com/sebastianbergmann/phpunit/issues/3495): Remove `assertArraySubset()`
* Implemented [#3951](https://github.com/sebastianbergmann/phpunit/issues/3951): Remove optional parameters of `assertFileEquals()` etc.

[9.0.0]: https://github.com/sebastianbergmann/phpunit/compare/8.5...master

76 changes: 8 additions & 68 deletions src/Framework/Assert.php
Expand Up @@ -495,27 +495,12 @@ public static function assertLessThanOrEqual($expected, $actual, string $message
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
public static function assertFileEquals(string $expected, string $actual, string $message = ''): void
{
// @codeCoverageIgnoreStart
if ($canonicalize) {
self::createWarning('The optional $canonicalize parameter of assertFileEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertFileEqualsCanonicalizing() instead.');
}

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

static::assertFileExists($expected, $message);
static::assertFileExists($actual, $message);

$constraint = new IsEqual(
\file_get_contents($expected),
0.0,
$canonicalize,
$ignoreCase
);
$constraint = new IsEqual(\file_get_contents($expected));

static::assertThat(\file_get_contents($actual), $constraint, $message);
}
Expand Down Expand Up @@ -572,28 +557,13 @@ public static function assertFileEqualsIgnoringCase(string $expected, string $ac
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
public static function assertFileNotEquals(string $expected, string $actual, string $message = ''): void
{
// @codeCoverageIgnoreStart
if ($canonicalize) {
self::createWarning('The optional $canonicalize parameter of assertFileNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertFileNotEqualsCanonicalizing() instead.');
}

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

static::assertFileExists($expected, $message);
static::assertFileExists($actual, $message);

$constraint = new LogicalNot(
new IsEqual(
\file_get_contents($expected),
0.0,
$canonicalize,
$ignoreCase
)
new IsEqual(\file_get_contents($expected),)
);

static::assertThat(\file_get_contents($actual), $constraint, $message);
Expand Down Expand Up @@ -655,26 +625,11 @@ public static function assertFileNotEqualsIgnoringCase(string $expected, string
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
public static function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = ''): void
{
// @codeCoverageIgnoreStart
if ($canonicalize) {
self::createWarning('The optional $canonicalize parameter of assertStringEqualsFile() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertStringEqualsFileCanonicalizing() instead.');
}

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

static::assertFileExists($expectedFile, $message);

$constraint = new IsEqual(
\file_get_contents($expectedFile),
0.0,
$canonicalize,
$ignoreCase
);
$constraint = new IsEqual(\file_get_contents($expectedFile),);

static::assertThat($actualString, $constraint, $message);
}
Expand Down Expand Up @@ -729,27 +684,12 @@ public static function assertStringEqualsFileIgnoringCase(string $expectedFile,
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
public static function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = ''): void
{
// @codeCoverageIgnoreStart
if ($canonicalize) {
self::createWarning('The optional $canonicalize parameter of assertStringNotEqualsFile() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertStringNotEqualsFileCanonicalizing() instead.');
}

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

static::assertFileExists($expectedFile, $message);

$constraint = new LogicalNot(
new IsEqual(
\file_get_contents($expectedFile),
0.0,
$canonicalize,
$ignoreCase
)
new IsEqual(\file_get_contents($expectedFile))
);

static::assertThat($actualString, $constraint, $message);
Expand Down
8 changes: 4 additions & 4 deletions src/Framework/Assert/Functions.php
Expand Up @@ -402,7 +402,7 @@ function assertLessThanOrEqual($expected, $actual, string $message = ''): void
*
* @see Assert::assertFileEquals
*/
function assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
function assertFileEquals(string $expected, string $actual, string $message = ''): void
{
Assert::assertFileEquals(...\func_get_args());
}
Expand Down Expand Up @@ -444,7 +444,7 @@ function assertFileEqualsIgnoringCase(string $expected, string $actual, string $
*
* @see Assert::assertFileNotEquals
*/
function assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
function assertFileNotEquals(string $expected, string $actual, string $message = ''): void
{
Assert::assertFileNotEquals(...\func_get_args());
}
Expand Down Expand Up @@ -486,7 +486,7 @@ function assertFileNotEqualsIgnoringCase(string $expected, string $actual, strin
*
* @see Assert::assertStringEqualsFile
*/
function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = ''): void
{
Assert::assertStringEqualsFile(...\func_get_args());
}
Expand Down Expand Up @@ -528,7 +528,7 @@ function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actual
*
* @see Assert::assertStringNotEqualsFile
*/
function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = ''): void
{
Assert::assertStringNotEqualsFile(...\func_get_args());
}
Expand Down

0 comments on commit 3c1e5ac

Please sign in to comment.