diff --git a/phpunit.xml b/phpunit.xml
index c2b19c2..310aedc 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -3,6 +3,7 @@
./tests/Expect
+ ./tests/Regression
diff --git a/src/Expectations/Time.php b/src/Expectations/Time.php
index 9d5e277..1a3a1ac 100644
--- a/src/Expectations/Time.php
+++ b/src/Expectations/Time.php
@@ -16,15 +16,23 @@ function (Closure $next, mixed $date) {
try {
$value = Carbon::make($this->value);
$expected = Carbon::make($date);
- } catch (Exception) { // @phpstan-ignore-line
- return $next();
- }
- if ($value === null) {
- return $next();
- }
+ if (! $value instanceof Carbon) {
+ return $next();
+ }
+
+ if (is_string($this->value) && str($this->value)->startsWith('@') && $value->format('Y-m-d H:i:s') === '1970-01-01 00:00:00') {
+ return $next();
+ }
- if ($expected === null) {
+ if (! $expected instanceof Carbon) {
+ return $next();
+ }
+
+ if (is_string($date) && str($date)->startsWith('@') && $value->format('Y-m-d H:i:s') === '1970-01-01 00:00:00') {
+ return $next();
+ }
+ } catch (Exception) { // @phpstan-ignore-line
return $next();
}
diff --git a/tests/Pest.php b/tests/Pest.php
index 07a387c..c68e707 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -5,6 +5,7 @@
use Tests\TestCase;
uses(TestCase::class)->in('Expect');
+uses(TestCase::class)->in('Regression');
/**
* @param callable(Response $response) $setup
diff --git a/tests/Regression/toBe_expectation_false_positive_test_issue_131.php b/tests/Regression/toBe_expectation_false_positive_test_issue_131.php
new file mode 100644
index 0000000..47ba3b3
--- /dev/null
+++ b/tests/Regression/toBe_expectation_false_positive_test_issue_131.php
@@ -0,0 +1,5 @@
+not->toBe('@littleDog');
+});