diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 0d1cd17c..7823cda6 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -160,6 +160,13 @@ final class TestCall return $this; } + public function hasNoExpectations(): TestCall + { + $this->testCaseMethod->proxies->add(Backtrace::file(), Backtrace::line(), 'expectNotToPerformAssertions', []); + + return $this; + } + /** * Saves the property accessors to be used on the target. */ diff --git a/tests/Features/HasNoExpectations.php b/tests/Features/HasNoExpectations.php new file mode 100644 index 00000000..a5804466 --- /dev/null +++ b/tests/Features/HasNoExpectations.php @@ -0,0 +1,11 @@ +expectNotToPerformAssertions(); + + $result = 1 + 1; +}); + +it('allows performing no expectations without being risky', function () { + $result = 1 + 1; +})->hasNoExpectations();