Adds support for chaining hasNoExpectations to the test method.

This commit is contained in:
luke
2021-12-08 08:58:42 +00:00
parent dd081c59b7
commit d969eaac2c
2 changed files with 18 additions and 0 deletions

View File

@ -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.
*/

View File

@ -0,0 +1,11 @@
<?php
it('allows access to the underlying expectNotToPerformAssertions method', function () {
$this->expectNotToPerformAssertions();
$result = 1 + 1;
});
it('allows performing no expectations without being risky', function () {
$result = 1 + 1;
})->hasNoExpectations();