mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 02:37:22 +01:00
Adds support for chaining hasNoExpectations to the test method.
This commit is contained in:
@ -160,6 +160,13 @@ final class TestCall
|
|||||||
return $this;
|
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.
|
* Saves the property accessors to be used on the target.
|
||||||
*/
|
*/
|
||||||
|
|||||||
11
tests/Features/HasNoExpectations.php
Normal file
11
tests/Features/HasNoExpectations.php
Normal 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();
|
||||||
Reference in New Issue
Block a user