Files
pest/tests/Features/Expect/dd.php
Punyapal Shah be49a3ce18 Fix: dd (#1692)
* fix: update dd method to return never type

Co-authored-by: Copilot <copilot@github.com>

* fix: enhance var_dump calls to accept additional arguments

* fix: update dd method to handle paratest and collision printer environments

* test: add dd method tests for ExpectationFailedException in parallel mode

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
2026-06-11 10:16:07 +01:00

39 lines
1.0 KiB
PHP

<?php
use PHPUnit\Framework\ExpectationFailedException;
it('dd throws ExpectationFailedException with dumped value in parallel mode', function () {
putenv('PARATEST=1');
try {
expect(42)->dd();
} catch (ExpectationFailedException $e) {
expect($e->getMessage())->toContain('42');
} finally {
putenv('PARATEST');
}
});
it('dd throws ExpectationFailedException with all dumped arguments in parallel mode', function () {
putenv('PARATEST=1');
try {
expect('hello')->dd('extra');
} catch (ExpectationFailedException $e) {
expect($e->getMessage())
->toContain('hello')
->toContain('extra');
} finally {
putenv('PARATEST');
}
});
it('dd throws ExpectationFailedException with dumped value when running under pest', function () {
expect($_SERVER['COLLISION_PRINTER'])->toBe('DefaultPrinter');
try {
expect(42)->dd();
} catch (ExpectationFailedException $e) {
expect($e->getMessage())->toContain('42');
}
});