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

plugin:test command ignores phpunit.xml environment variables #5799

Open
uematsusoft opened this issue May 16, 2024 · 2 comments
Open

plugin:test command ignores phpunit.xml environment variables #5799

uematsusoft opened this issue May 16, 2024 · 2 comments

Comments

@uematsusoft
Copy link

Hello,

When testing a plugin with the command php artisan plugin:test PLUGIN.NAME the environment variables defined in the phpunit.xml file are ignored destroying, in my case, the database state.

The only way that I was able to run the test in another set of env variables is to create an .env.testing file and then, run the command forcing the enviroment php artisan plugin:test PLUGIN.NAME --env=testing.

If i run the command ..\..\..\vendor\bin\phpunit, in the plugin's folder, everything works correctly even without the .env.testing file.

October version is 3.6.18, phpunit is 10.*, php is 8.1.28 and I am using Window 10.

Thank you.

@daftspunk
Copy link
Member

daftspunk commented May 22, 2024

Hi @uematsusoft

Does it ignore the variables set in phpunit.xml? Eg:

    <php>
        <env name="APP_ENV" value="testing" />
        <env name="APP_LOCALE" value="en" />
        <env name="CACHE_DRIVER" value="array" />
        <env name="SESSION_DRIVER" value="array" />
        <env name="ACTIVE_THEME" value="test" />
        <env name="CONVERT_LINE_ENDINGS" value="true" />
        <env name="CMS_SAFE_MODE" value="false" />
        <env name="CMS_ROUTE_CACHE" value="true" />
        <env name="CMS_TWIG_CACHE" value="false" />
        <env name="PLUGINS_PATH" value="modules/system/tests/fixtures/plugins" />
        <env name="THEMES_PATH" value="modules/cms/tests/fixtures/themes" />
        <env name="ENABLE_CSRF" value="false" />
        <env name="DB_CONNECTION" value="sqlite" />
        <env name="DB_DATABASE" value=":memory:" />
    </php>

@uematsusoft
Copy link
Author

Yes, and the .env.testing as well. The only way that it does not ignore the .env.testing is if I add the --env=testing parameter to the command.

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

No branches or pull requests

2 participants