diff --git a/src/Mixins/Expectation.php b/src/Mixins/Expectation.php index d087162d..bd658817 100644 --- a/src/Mixins/Expectation.php +++ b/src/Mixins/Expectation.php @@ -6,6 +6,7 @@ namespace Pest\Mixins; use BadMethodCallException; use Closure; +use DateTimeInterface; use Error; use InvalidArgumentException; use Pest\Exceptions\InvalidExpectationValue; @@ -124,7 +125,7 @@ final class Expectation * * @return self */ - public function toBeGreaterThan(int|float|\DateTime|\DateTimeImmutable $expected, string $message = ''): self + public function toBeGreaterThan(int|float|DateTimeInterface $expected, string $message = ''): self { Assert::assertGreaterThan($expected, $this->value, $message); @@ -136,7 +137,7 @@ final class Expectation * * @return self */ - public function toBeGreaterThanOrEqual(int|float|\DateTime|\DateTimeImmutable $expected, string $message = ''): self + public function toBeGreaterThanOrEqual(int|float|DateTimeInterface $expected, string $message = ''): self { Assert::assertGreaterThanOrEqual($expected, $this->value, $message); @@ -148,7 +149,7 @@ final class Expectation * * @return self */ - public function toBeLessThan(int|float|\DateTime|\DateTimeImmutable $expected, string $message = ''): self + public function toBeLessThan(int|float|DateTimeInterface $expected, string $message = ''): self { Assert::assertLessThan($expected, $this->value, $message); @@ -160,7 +161,7 @@ final class Expectation * * @return self */ - public function toBeLessThanOrEqual(int|float|\DateTime|\DateTimeImmutable $expected, string $message = ''): self + public function toBeLessThanOrEqual(int|float|DateTimeInterface $expected, string $message = ''): self { Assert::assertLessThanOrEqual($expected, $this->value, $message); diff --git a/tests/.snapshots/Failure.php.inc b/tests/.snapshots/Failure.php.inc index 103d5d4b..52fca5f5 100644 --- a/tests/.snapshots/Failure.php.inc +++ b/tests/.snapshots/Failure.php.inc @@ -1,6 +1,6 @@ ##teamcity[testSuiteStarted name='Tests/tests/Failure' locationHint='file://tests/.tests/Failure.php' flowId='1234'] ##teamcity[testStarted name='it can fail with comparison' locationHint='pest_qn://tests/.tests/Failure.php::it can fail with comparison' flowId='1234'] -##teamcity[testFailed name='it can fail with comparison' message='Failed asserting that true matches expected false.' details='at src/Mixins/Expectation.php:342|nat src/Support/ExpectationPipeline.php:75|nat src/Support/ExpectationPipeline.php:79|nat src/Expectation.php:300|nat tests/.tests/Failure.php:6|nat src/Factories/TestCaseMethodFactory.php:100|nat src/Concerns/Testable.php:302|nat src/Support/ExceptionTrace.php:28|nat src/Concerns/Testable.php:302|nat src/Concerns/Testable.php:221|nat src/Kernel.php:86' type='comparisonFailure' actual='true' expected='false' flowId='1234'] +##teamcity[testFailed name='it can fail with comparison' message='Failed asserting that true matches expected false.' details='at src/Mixins/Expectation.php:343|nat src/Support/ExpectationPipeline.php:75|nat src/Support/ExpectationPipeline.php:79|nat src/Expectation.php:300|nat tests/.tests/Failure.php:6|nat src/Factories/TestCaseMethodFactory.php:100|nat src/Concerns/Testable.php:302|nat src/Support/ExceptionTrace.php:28|nat src/Concerns/Testable.php:302|nat src/Concerns/Testable.php:221|nat src/Kernel.php:86' type='comparisonFailure' actual='true' expected='false' flowId='1234'] ##teamcity[testFinished name='it can fail with comparison' duration='100000' flowId='1234'] ##teamcity[testStarted name='it can be ignored because of no assertions' locationHint='pest_qn://tests/.tests/Failure.php::it can be ignored because of no assertions' flowId='1234'] ##teamcity[testIgnored name='it can be ignored because of no assertions' message='This test did not perform any assertions' details='' flowId='1234']