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

Issue with running test inside docker container #6

Open
jenky opened this issue Aug 22, 2022 · 5 comments
Open

Issue with running test inside docker container #6

jenky opened this issue Aug 22, 2022 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@jenky
Copy link

jenky commented Aug 22, 2022

docker compose exec {php_container} bin/phpunit /var/www/app/tests/Unit/MyTest.php

spawn docker compose exec php bin/phpunit ENOENT
-------------------------------------------------------

However when I'm enabling Show output to Terminal, the test case is running without problems but the status of the test case in the UI and test explorer still marked as error

@RobertOstermann
Copy link
Owner

Could you try setting phpunit.workingDirectory = 'parent' in your settings?

@jenky
Copy link
Author

jenky commented Aug 23, 2022

I did, here are my current settings

"phpunit.docker.enable": true,
"phpunit.docker.command": "docker compose exec php ",
"phpunit.pathMappings": {
    "~/my-local-directory/app": "/var/www/app"
},
"phpunit.execPath": "bin/phpunit",
"phpunit.testExplorer.folderPattern": "app/{test,tests,Test,Tests}/**/*.php",
"phpunit.workingDirectory": "Parent",

@RobertOstermann
Copy link
Owner

I haven't really tested this using docker and am not sure what the problem is here. Are you using Windows? And is that output what is shown in the terminal or the output channel?

@jenky
Copy link
Author

jenky commented Aug 24, 2022

I'm using Mac. The output came from output channel. The problem is it didn't run then marked the test case as error while everything was ok if I ran the test case from CLI

@RobertOstermann RobertOstermann added the help wanted Extra attention is needed label Aug 26, 2022
@RobertOstermann
Copy link
Owner

I don't have the experience with docker to pinpoint and fix this problem. The ENOENT error usually means a problem with the working directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants