Skip to content

Add max nesting level configuration option#46

Closed
olsavmic wants to merge 1 commit intosebastianbergmann:mainfrom
olsavmic:olsavmic-max-nesting-level
Closed

Add max nesting level configuration option#46
olsavmic wants to merge 1 commit intosebastianbergmann:mainfrom
olsavmic:olsavmic-max-nesting-level

Conversation

@olsavmic
Copy link

@olsavmic olsavmic commented May 6, 2022

@olsavmic olsavmic force-pushed the olsavmic-max-nesting-level branch from 1d57ee9 to d7ff650 Compare May 6, 2022 09:30
@sebastianbergmann
Copy link
Owner

How do you envision configuring this setting from PHPUnit?

@olsavmic
Copy link
Author

olsavmic commented Aug 5, 2022

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.

@sebastianbergmann
Copy link
Owner

Superseded by #55.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants