Skip to content

Commit

Permalink
Closes #5473
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 7, 2024
1 parent d0f8ab9 commit da4c344
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 225 deletions.
1 change: 1 addition & 0 deletions ChangeLog-12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All notable changes of the PHPUnit 12.0 release series are documented in this fi
* [#5314](https://github.com/sebastianbergmann/phpunit/issues/5314): `MockBuilder::getMockForAbstractClass()`
* [#5316](https://github.com/sebastianbergmann/phpunit/issues/5316): `MockBuilder::enableArgumentCloning()` and `MockBuilder::disableArgumentCloning()`
* [#5321](https://github.com/sebastianbergmann/phpunit/issues/5321): `MockBuilder::addMethods()`
* [#5473](https://github.com/sebastianbergmann/phpunit/issues/5473): `assertStringNotMatchesFormat()` and `assertStringNotMatchesFormatFile()`
* [#5978](https://github.com/sebastianbergmann/phpunit/issues/5978): Support for PHP 8.2

[12.0.0]: https://github.com/sebastianbergmann/phpunit/compare/11.5...main
7 changes: 0 additions & 7 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co

### Writing Tests

#### Assertions, Constraints, and Expectations

| Issue | Description | Since | Replacement |
|-------------------------------------------------------------------|------------------------------------------------|--------|-------------|
| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormat()` | 10.4.0 | |
| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormatFile()` | 10.4.0 | |

#### Test Double API

| Issue | Description | Since | Replacement |
Expand Down
55 changes: 0 additions & 55 deletions src/Framework/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use ArrayAccess;
use Countable;
use Generator;
use PHPUnit\Event;
use PHPUnit\Framework\Constraint\ArrayHasKey;
use PHPUnit\Framework\Constraint\Callback;
use PHPUnit\Framework\Constraint\Constraint;
Expand Down Expand Up @@ -1747,29 +1746,6 @@ final public static function assertStringMatchesFormat(string $format, string $s
self::assertThat($string, new StringMatchesFormatDescription($format), $message);
}

/**
* Asserts that a string does not match a given format string.
*
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5472
*/
final public static function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void
{
Event\Facade::emitter()->testTriggeredPhpunitDeprecation(
null,
'assertStringNotMatchesFormat() is deprecated and will be removed in PHPUnit 12 without replacement.',
);

self::assertThat(
$string,
new LogicalNot(
new StringMatchesFormatDescription($format),
),
$message,
);
}

/**
* Asserts that a string matches a given format file.
*
Expand All @@ -1792,37 +1768,6 @@ final public static function assertStringMatchesFormatFile(string $formatFile, s
);
}

/**
* Asserts that a string does not match a given format string.
*
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5472
*/
final public static function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void
{
Event\Facade::emitter()->testTriggeredPhpunitDeprecation(
null,
'assertStringNotMatchesFormatFile() is deprecated and will be removed in PHPUnit 12 without replacement.',
);

self::assertFileExists($formatFile, $message);

$formatDescription = file_get_contents($formatFile);

self::assertIsString($formatDescription);

self::assertThat(
$string,
new LogicalNot(
new StringMatchesFormatDescription(
$formatDescription,
),
),
$message,
);
}

/**
* Asserts that a string starts with a given prefix.
*
Expand Down
36 changes: 0 additions & 36 deletions src/Framework/Assert/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1977,24 +1977,6 @@ function assertStringMatchesFormat(string $format, string $string, string $messa
}
}

if (!function_exists('PHPUnit\Framework\assertStringNotMatchesFormat')) {
/**
* Asserts that a string does not match a given format string.
*
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5472
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see Assert::assertStringNotMatchesFormat
*/
function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void
{
Assert::assertStringNotMatchesFormat(...func_get_args());
}
}

if (!function_exists('PHPUnit\Framework\assertStringMatchesFormatFile')) {
/**
* Asserts that a string matches a given format file.
Expand All @@ -2011,24 +1993,6 @@ function assertStringMatchesFormatFile(string $formatFile, string $string, strin
}
}

if (!function_exists('PHPUnit\Framework\assertStringNotMatchesFormatFile')) {
/**
* Asserts that a string does not match a given format string.
*
* @throws ExpectationFailedException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5472
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see Assert::assertStringNotMatchesFormatFile
*/
function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void
{
Assert::assertStringNotMatchesFormatFile(...func_get_args());
}
}

if (!function_exists('PHPUnit\Framework\assertStringStartsWith')) {
/**
* Asserts that a string starts with a given prefix.
Expand Down
20 changes: 0 additions & 20 deletions tests/end-to-end/event/_files/DeprecatedAssertionTest.php

This file was deleted.

39 changes: 0 additions & 39 deletions tests/end-to-end/event/deprecated-assertion.phpt

This file was deleted.

This file was deleted.

34 changes: 0 additions & 34 deletions tests/unit/Framework/Assert/assertStringNotMatchesFormatTest.php

This file was deleted.

0 comments on commit da4c344

Please sign in to comment.