Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Debugging unit tests? #6

Open
rulatir opened this issue Jul 25, 2019 · 0 comments
Open

Debugging unit tests? #6

rulatir opened this issue Jul 25, 2019 · 0 comments

Comments

@rulatir
Copy link

rulatir commented Jul 25, 2019

Here are the relevant parts of my workspace configuration:

    "yet-phpunit.docker.enable": true,
    "yet-phpunit.docker.command": "docker-compose -f /home/rulatir/works/webzuu/zuu/docker/docker-compose-dev.yml --project-directory=/home/rulatir/works/webzuu/zuu exec php /usr/bin/env XDEBUG_CONFIG=\"remote_host=172.17.0.1\",
    "yet-phpunit.phpunitBinary": "/apps/cms/vendor/bin/phpunit",
    "yet-phpunit.xmlConfigFilepath": "/apps/cms/phpunit.xml",
    "yet-phpunit.codelens": true,
    "yet-phpunit.docker.paths": {
        "/home/rulatir/works/webzuu/zuu/apps/cms": "/apps/cms"
    },

As you can see, the docker command uses env to pass XDEBUG_CONFIG to phpunit. It works. I can set a breakpoint in a test method, hit the codelens, and it stops on the breakpoint. But I would like to be able to define a separate "run configuration" for debugging tests, and there doesn't seem to be a way to do this.

I want to be able to:

  • debug my tests with Xdebug extension loaded and the right env vars passed,
  • run my tests normally with an alternate no-xdebug php.ini,
  • without having to edit the configuration every time I want to switch between the above two modes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant