Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema for PHPUnit 9.5 is not available #57

Closed
alexius opened this issue Jul 20, 2021 · 3 comments
Closed

Schema for PHPUnit 9.5 is not available #57

alexius opened this issue Jul 20, 2021 · 3 comments

Comments

@alexius
Copy link

alexius commented Jul 20, 2021

Try to run tests on newly installed Lumen Framework and get this error "Schema for PHPUnit 9.5 is not available".

My composer.json for the project:


{
    "name": "api/service",
    "description": "API Service.",
    "keywords": ["framework", "laravel", "lumen"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.4|^8.0",
        "flipbox/lumen-generator": "^8.2",
        "intervention/image": "^2.6",
        "laravel/lumen-framework": "^8.0"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "league/flysystem": "^1.0",
        "mockery/mockery": "^1.3.1",
        "phpunit/phpunit": "^9.3"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "classmap": [
          "tests/"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ]
    }
}

Installed version in project you can see on picture:
Screen Shot 2021-07-20 at 9 07 54 PM

There is no 9.5.xsd file in the folder of PHPUnit:
Screen Shot 2021-07-20 at 8 39 55 PM

Maybe this is a reason.

How can I resolve this problem?

Thank you.

@sebastianbergmann
Copy link
Owner

The files in the schema folder are the schemas for older versions. The phpunit.xsd file in the root directory is the schema for the current version.

@alexius
Copy link
Author

alexius commented Jul 21, 2021

Yes, I know, thanks.

I didn't make any changes in phpunit folder. It's fresh installed and I got this error. In phpunit.xml I have:

<?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"
>
    <testsuites>
        <testsuite name="Application Test Suite">
            <directory suffix="Test.php">./tests</directory>
        </testsuite>
    </testsuites>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="DB_CONNECTION" value="sqlite"/>
    </php>
</phpunit>

I use the command for running the tests: vendor/bin/phpunit
What to do to resolve an issue?

Thank you.

@alexius
Copy link
Author

alexius commented Jul 21, 2021

As I understood the problem is in determination of the path of phpunit.xsd file in SchemaFinder class.

Here you have in path() function:
return __DIR__ . '/../../phpunit/';

But you need to go two folders upper:
Screen Shot 2021-07-21 at 9 17 28 AM

So if i change to:
return __DIR__ . '/../../../../phpunit/';
the error is gone.

I don't know if it's a right decision.

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

No branches or pull requests

2 participants