phpunit-documentation-english
phpunit-documentation-english copied to clipboard
Example for extension with arguments not working
Example 10.5 from the documentation for extending phpunit crashes with the following message:
PHP Fatal error: Uncaught TypeError: Argument 2 passed to MyExtension::__construct() must be of the type int, null given in /mnt/c/Users/kanit/Documents ...
Example 10.5 TestRunner Extension configuration
<extensions>
<extension class="Vendor\MyUnconfigurableExtension" />
<extension class="Vendor\MyConfigurableExtension">
<arguments>
<string>Hello world!</string>
<int>15</int>
</arguments>
</extension>
</extensions>
However changing the tag <int> to <integer> fixes the problem
...
<arguments>
<string>Hello world!</string>
<integer>15</integer>
</arguments>
...
I just tried Example 10.4 and it didn't work too because the variables $config_1 and $config_2 aren't really the ones passed in the constructor. They should be changed to $value1 and $value2.
This type of extensions is no longer supported.