Skip to content

Commit

Permalink
Initial work on ##3332, #3338, and #3341
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 11, 2018
1 parent 4517008 commit c584a0d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog-7.5.md
Expand Up @@ -8,5 +8,11 @@ All notable changes of the PHPUnit 7.5 release series are documented in this fil

* Implemented [#3340](https://github.com/sebastianbergmann/phpunit/issues/3340): Added `assertEqualsCanonicalizing()`, `assertEqualsIgnoringCase()`, `assertEqualsWithDelta()`, `assertNotEqualsCanonicalizing()`, `assertNotEqualsIgnoringCase()`, and `assertNotEqualsWithDelta()` as alternatives to using `assertEquals()` and `assertNotEquals()` with the `$delta`, `$canonicalize`, or `$ignoreCase` parameters

### Deprecated

* The optional parameters `$delta`, `$maxDepth`, `$canonicalize`, and `$ignoreCase` of `assertEquals()`, and `assertNotEquals` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these parameters will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these parameters will be removed.
* The methods `assertAttributeContains()`, `assertAttributeNotContains()`, `assertAttributeContainsOnly()`, `assertAttributeNotContainsOnly()`, `assertAttributeCount()`, `assertAttributeNotCount()`, `assertAttributeEquals()`, `assertAttributeNotEquals()`, `assertAttributeEmpty()`, `assertAttributeNotEmpty()`, `assertAttributeGreaterThan()`, `assertAttributeGreaterThanOrEqual()`, `assertAttributeLessThan()`, `assertAttributeLessThanOrEqual()`, `assertAttributeSame()`, `assertAttributeNotSame()`, `assertAttributeInstanceOf()`, `assertAttributeNotInstanceOf()`, `assertAttributeInternalType()`, `assertAttributeNotInternalType()`, `attributeEqualTo()`, `readAttribute()`, `getStaticAttribute()`, and `getObjectAttribute()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods will be removed.
* The annotations `@expectedException`, `@expectedExceptionCode`, `@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these annotations will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

[7.5.0]: https://github.com/sebastianbergmann/phpunit/compare/7.4...7.5.0

52 changes: 52 additions & 0 deletions src/Framework/Assert.php
Expand Up @@ -209,6 +209,8 @@ public static function assertContains($needle, $haystack, string $message = '',
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
{
Expand Down Expand Up @@ -271,6 +273,8 @@ public static function assertNotContains($needle, $haystack, string $message = '
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
{
Expand Down Expand Up @@ -333,6 +337,8 @@ public static function assertContainsOnlyInstancesOf(string $className, iterable
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void
{
Expand Down Expand Up @@ -378,6 +384,8 @@ public static function assertNotContainsOnly(string $type, iterable $haystack, ?
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void
{
Expand Down Expand Up @@ -418,6 +426,8 @@ public static function assertCount(int $expectedCount, $haystack, string $messag
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -457,6 +467,8 @@ public static function assertNotCount(int $expectedCount, $haystack, string $mes
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -547,6 +559,8 @@ public static function assertEqualsWithDelta($expected, $actual, float $delta, s
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
{
Expand Down Expand Up @@ -654,6 +668,8 @@ public static function assertNotEqualsWithDelta($expected, $actual, float $delta
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
{
Expand Down Expand Up @@ -687,6 +703,8 @@ public static function assertEmpty($actual, string $message = ''): void
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -715,6 +733,8 @@ public static function assertNotEmpty($actual, string $message = ''): void
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -742,6 +762,8 @@ public static function assertGreaterThan($expected, $actual, string $message = '
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeGreaterThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -774,6 +796,8 @@ public static function assertGreaterThanOrEqual($expected, $actual, string $mess
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeGreaterThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -802,6 +826,8 @@ public static function assertLessThan($expected, $actual, string $message = ''):
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeLessThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -830,6 +856,8 @@ public static function assertLessThanOrEqual($expected, $actual, string $message
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeLessThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -1383,6 +1411,8 @@ public static function assertSame($expected, $actual, string $message = ''): voi
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -1424,6 +1454,8 @@ public static function assertNotSame($expected, $actual, string $message = ''):
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -1460,6 +1492,8 @@ public static function assertInstanceOf(string $expected, $actual, string $messa
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -1498,6 +1532,8 @@ public static function assertNotInstanceOf(string $expected, $actual, string $me
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -1530,6 +1566,8 @@ public static function assertInternalType(string $expected, $actual, string $mes
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -1564,6 +1602,8 @@ public static function assertNotInternalType(string $expected, $actual, string $
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function assertAttributeNotInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void
{
Expand Down Expand Up @@ -2191,6 +2231,9 @@ public static function isNan(): IsNan
return new IsNan;
}

/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function attribute(Constraint $constraint, string $attributeName): Attribute
{
return new Attribute($constraint, $attributeName);
Expand Down Expand Up @@ -2224,6 +2267,9 @@ public static function equalTo($value, float $delta = 0.0, int $maxDepth = 10, b
return new IsEqual($value, $delta, $maxDepth, $canonicalize, $ignoreCase);
}

/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function attributeEqualTo(string $attributeName, $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): Attribute
{
return static::attribute(
Expand Down Expand Up @@ -2368,6 +2414,8 @@ public static function fail(string $message = ''): void
* @param object|string $classOrObject
*
* @throws Exception
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function readAttribute($classOrObject, string $attributeName)
{
Expand Down Expand Up @@ -2408,6 +2456,8 @@ public static function readAttribute($classOrObject, string $attributeName)
*
* @throws Exception
* @throws ReflectionException
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function getStaticAttribute(string $className, string $attributeName)
{
Expand Down Expand Up @@ -2446,6 +2496,8 @@ public static function getStaticAttribute(string $className, string $attributeNa
* @param object $object
*
* @throws Exception
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
*/
public static function getObjectAttribute($object, string $attributeName)
{
Expand Down

0 comments on commit c584a0d

Please sign in to comment.