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

[FrameworkBundle] KernelTestCase does not respect test env #1313

Open
IndraGunawan opened this issue May 2, 2024 · 0 comments
Open

[FrameworkBundle] KernelTestCase does not respect test env #1313

IndraGunawan opened this issue May 2, 2024 · 0 comments
Labels

Comments

@IndraGunawan
Copy link

IndraGunawan commented May 2, 2024

Symfony version(s) affected

7.0.7

Description

getting the following error while running WebTestCase tests

symfony php bin/phpunit
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

Testing
E                                                                   1 / 1 (100%)

Time: 00:00.102, Memory: 20.00 MB

There was 1 error:

1) App\Tests\WebTest::testSomething
LogicException: You cannot create the client used in functional tests if the "framework.test" config is not set to true.

/tmp/test/vendor/symfony/framework-bundle/Test/WebTestCase.php:50
/tmp/test/tests/WebTest.php:11
/tmp/test/vendor/phpunit/phpunit/phpunit:107

How to reproduce

symfony new --webapp test
cd test
symfony console make:test WebTestCase WebTest
symfony php bin/phpunit

Possible Solution

modify phpunit.xml.dist file

<php>
   ...
-    <server name="APP_ENV" value="test" force="true" />
+    <env name="APP_ENV" value="test" force="true" />
+    <env name="KERNEL_CLASS" value="App\Kernel" />
   ...
</php>

Additional Context

No response

@chalasr chalasr transferred this issue from symfony/symfony May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant