exporter icon indicating copy to clipboard operation
exporter copied to clipboard

Add max nesting level configuration option

Open olsavmic opened this issue 2 years ago • 2 comments

Prerequisite for https://github.com/sebastianbergmann/phpunit/issues/4965#issue-1224068762

olsavmic avatar May 06 '22 09:05 olsavmic

How do you envision configuring this setting from PHPUnit?

sebastianbergmann avatar Jul 28 '22 12:07 sebastianbergmann

Ideally as a phpunit element attribute in the XMLConfiguration.

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
        colors="true"
        exporterMaxDepth=5
>
...
</phpunit>

I see that the Exporter is being created in a lot of different places, especially in the \PHPUnit\Framework\Constraint\Constraint::exporter() method.

I don't see a reason to keep an instance of Exporter per Constraint (or any formatted object), I'd suggest passing the Exporter instance into the toString() and similar methods instead.

That'd require a bit of refactoring though and since it's a global configuration of a testing environment only, I'd be fine with accessing a public static configuration variable during Exporter instantiation.

olsavmic avatar Aug 05 '22 15:08 olsavmic