mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat(expect): removes ignore cases related assertions
This commit is contained in:
@ -168,19 +168,6 @@ final class Expectation
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Asserts that two variables are equals, ignoring the casing
|
|
||||||
* for the comparison.
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
public function toEqualIgnoringCase($value): Expectation
|
|
||||||
{
|
|
||||||
Assert::assertEqualsIgnoringCase($value, $this->value);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that two variables have the same value.
|
* Asserts that two variables have the same value.
|
||||||
* The contents of $expected and $actual are canonicalized before
|
* The contents of $expected and $actual are canonicalized before
|
||||||
@ -205,7 +192,7 @@ final class Expectation
|
|||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function toBeEqualWithDelta($value, float $delta): Expectation
|
public function toEqualWithDelta($value, float $delta): Expectation
|
||||||
{
|
{
|
||||||
Assert::assertEqualsWithDelta($value, $this->value, $delta);
|
Assert::assertEqualsWithDelta($value, $this->value, $delta);
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use PHPUnit\Framework\ExpectationFailedException;
|
|
||||||
|
|
||||||
test('pass', function () {
|
|
||||||
expect('00123')->toEqualCanonicalizing(123);
|
|
||||||
expect(['a', 'b', 'c'])->toEqualCanonicalizing(['c', 'a', 'b']);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('failures', function () {
|
|
||||||
expect(['a', 'b', 'c'])->toEqualCanonicalizing(['a', 'b']);
|
|
||||||
})->throws(ExpectationFailedException::class);
|
|
||||||
|
|
||||||
test('not failures', function () {
|
|
||||||
expect('042')->not->toEqualCanonicalizing(42);
|
|
||||||
})->throws(ExpectationFailedException::class);
|
|
||||||
@ -3,13 +3,13 @@
|
|||||||
use PHPUnit\Framework\ExpectationFailedException;
|
use PHPUnit\Framework\ExpectationFailedException;
|
||||||
|
|
||||||
test('pass', function () {
|
test('pass', function () {
|
||||||
expect(1.0)->toBeEqualWithDelta(1.3, .4);
|
expect(1.0)->toEqualWithDelta(1.3, .4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('failures', function () {
|
test('failures', function () {
|
||||||
expect(1.0)->toBeEqualWithDelta(1.5, .1);
|
expect(1.0)->toEqualWithDelta(1.5, .1);
|
||||||
})->throws(ExpectationFailedException::class);
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|
||||||
test('not failures', function () {
|
test('not failures', function () {
|
||||||
expect(1.0)->not->toBeEqualWithDelta(1.6, .7);
|
expect(1.0)->not->toEqualWithDelta(1.6, .7);
|
||||||
})->throws(ExpectationFailedException::class);
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user