Phpunit: Unable to send array arg to listeners

Created on 1 Aug 2018  路  5Comments  路  Source: sebastianbergmann/phpunit

| Q | A
| --------------------| ---------------
| PHPUnit version | 7.2.7
| PHP version | 7.2
| Installation Method | Composer

I have a listener that requires an array, the docs for 7.1 state that array is a legal arg type. However, in 7.2 (which I can't find the docs for) I get this error:

Element 'array': This element is not expected. Expected is one of ( string, double, null, object, file, directory, boolean ).

My config inside the <arguments>

                <string>foo</string>
                <string>bar</string>
                <array> <!-- includes -->
                    <element key="0">
                        <string>string value</string>
                    </element>
                </array>

After some experimentation, it would appear that array elements must appear first in the list of arguments though the documentation makes no mention of this.

Is this a bug?

typbug

All 5 comments

This is probably another case (like #3248) where the XSD is too strict.

It does look similar!

Most certainly.

Maybe I should have checked more occasions of <xs:sequence> while fixing bug #3248.

I'll have a look later unless somebody beats me to it.

@theseer That would be much appreciated!

As part of an upcoming code sprint, we might want to add more integration level tests for the schema checks by adding multiple valid xml files that should pass.

There might be more things :)

Was this page helpful?
0 / 5 - 0 ratings