mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
29 lines
890 B
PHP
29 lines
890 B
PHP
<?php
|
|
|
|
use NunoMaduro\Collision\Contracts\RenderableOnCollisionEditor;
|
|
use PHPUnit\Event\Code\ThrowableBuilder;
|
|
use Whoops\Exception\Frame;
|
|
|
|
test('collision editor can be added to the stack trace', function () {
|
|
$exception = new class extends Exception implements RenderableOnCollisionEditor
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct('test exception');
|
|
}
|
|
|
|
public function toCollisionEditor(): Frame
|
|
{
|
|
return new Frame([
|
|
'file' => __DIR__.'/../../Pest.php',
|
|
'line' => 5,
|
|
]);
|
|
}
|
|
};
|
|
|
|
expect(ThrowableBuilder::from($exception)->stackTrace())
|
|
->toContain('tests/Unit/Overrides/../../Pest.php:5')
|
|
->and(ThrowableBuilder::from(new Exception('test'))->stackTrace())
|
|
->toContain('tests/Unit/Overrides/ThrowableBuilder.php:26');
|
|
});
|