Files
pest/tests/Unit/Support/ExceptionTrace.php
2024-06-27 01:41:34 +01:00

22 lines
763 B
PHP

<?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 [pest()->extend()] function? Read more at: https://pestphp.com/docs/configuring-tests',
);