gerardroche / sublime-phpunit

PHPUnit Sublime Text integration.
https://www.gerardroche.com
GNU General Public License v3.0
74 stars 11 forks source link

exclude-group: none not working #91

Closed myself379 closed 5 years ago

myself379 commented 5 years ago

Hi,

I run into this issue when I tried to annotate a test function with @group integration, I still wants to run it via phpunit_test_nearest but even with

phpunit.option={
    "exclude-group": "none"
}

The test is still not run. How can I force to run and ignore @group for this phpunit package?

myself379 commented 5 years ago

For now, I just use a different name instead of @group integration. Perhaps I'll close this topic as there is no reproducibility.

gerardroche commented 5 years ago

The exclude-group should work.

For example given the test:

class GroupTest extends \PHPUnit\Framework\TestCase
{
    public function testGroup1()
    {
        $this->assertTrue(true);
    }

    /**
     * @group hello
     */
    public function testExcludeGroupHello()
    {
        $this->assertTrue(true);
    }
}

Running the following on the command-line with exclude the test annotated with @group hello:

$ vendor/bin/phpunit --testdox --exclude-group hello

You can set as a global option in Sublime: Configure settings via Menu > Preferences > Settings or by the Command Palette. To use the command palette:

  1. Press Ctrl+Shift+P
  2. Select the "Preferences: Settings" command
  3. Press Enter
    "phpunit.options":
    {
        "no-coverage": true,
        "exclude-group": "hello"
    },

If you also turn on the debug option:

    "phpunit.debug": true

And then view the console when you run test (Menu > View > Show Console), you should see the command that is run, for example:

Running /path/to/sublime-phpunit-testing/vendor/bin/phpunit --no-coverage --exclude-group hello test/GroupTest.php

In the case above, the "hello" group should be ignored.