What means: "Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!"
Asked Answered
L

4

31

I have included PHPUnit in a test vanilla PHP project and when I start the test with vendor/bin/phpunit I get the following error message:

Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

Question: What does this error message mean and what do I have to do to avoid it?

My phpunit.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
         verbose="true"
         stopOnFailure="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
    </testsuites>
</phpunit>

I using phpunit 10

    "require-dev": {
        "phpunit/phpunit": "^10.0"
    }
Lea answered 23/2, 2023 at 9:58 Comment(0)
H
66

Run vendor/bin/phpunit --migrate-configuration

Hermit answered 8/3, 2023 at 17:12 Comment(2)
if the XML file is somewhere else: vendor/bin/phpunit -c tests/phpunit.xml --migrate-configurationHuntlee
In addition, for running artisan dusk use this: vendor/bin/phpunit -c phpunit.dusk.xml --migrate-configurationElijaheliminate
A
4

If you have upgraded to Laravel10, according to Laravel website, you should do this:

if you wish to use PHPUnit 10, you should delete the processUncoveredFiles attribute from the <coverage> section of your application's phpunit.xml configuration file. Then, update the following dependencies in your application's composer.json file:

nunomaduro/collision to ^7.0

phpunit/phpunit to ^10.0
Anchises answered 16/3, 2023 at 6:49 Comment(0)
G
1

Try once below, read more here

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
         verbose="true"
         stopOnFailure="true"
>
    <include>
        <directory suffix="Test.php">./tests/Unit</directory>
    </include>
</phpunit>
Graduate answered 23/2, 2023 at 10:9 Comment(1)
I get new Error: <include> <directory suffix="Test.php">./tests/Unit</directory> </include>Lea
C
1

I had a similar issue, but my < include > tag was inside a < coverage > tag.

Before

<coverage processUncoveredFiles="true">
    <include>
        <directory suffix=".php">./app</directory>
    </include>
</coverage>

After

<source>
    <include>
        <directory suffix=".php">./app</directory>
    </include>
</source>
Curtilage answered 3/10, 2023 at 18:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.