mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
feat: uses()hint
This commit is contained in:
21
tests/Unit/Support/ExceptionTrace.php
Normal file
21
tests/Unit/Support/ExceptionTrace.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Pest\Support\ExceptionTrace;
|
||||
|
||||
it('ensures the given closures reports the correct class name', function () {
|
||||
$closure = function () {
|
||||
throw new Exception('Call to undefined method P\Tests\IntentionallyNotExisting::testBasic().');
|
||||
};
|
||||
|
||||
ExceptionTrace::ensure($closure);
|
||||
})->throws(
|
||||
Exception::class,
|
||||
'Call to undefined method Tests\IntentionallyNotExisting::testBasic().',
|
||||
);
|
||||
|
||||
it('ensures the given closures reports the correct class name and suggests the [uses()] function', function () {
|
||||
$this->get();
|
||||
})->throws(
|
||||
Error::class,
|
||||
'Call to undefined method Tests\Unit\Support\ExceptionTrace::get(). Did you forget to use the [uses()] function? https://pestphp.com/docs/configuring-tests',
|
||||
);
|
||||
Reference in New Issue
Block a user