Publish results simple and easy.
composer require qase/phpunit-reporterThe PHPUnit reporter has the ability to auto-generate test cases and suites from your test data.
But if necessary, you can independently register the ID of already existing test cases from TMS before the executing tests. For example:
/**
 * @qaseId 3
 */
public function testCanBeUsedAsString(): void
{
    $this->assertEquals(
        '[email protected]',
        Email::fromString('[email protected]')
    );
}You should also have an active item in the project settings at
https://app.qase.io/project/QASE_PROJECT_CODE/settings/options
options in the Test Runs block:
Auto create test cases
and
Allow submitting results in bulk
To run tests and create a test run, execute the command:
$ ./vendor/bin/phpunitA test run will be performed and available at:
https://app.qase.io/run/QASE_PROJECT_CODE
If test fails, a defect will be automatically created
PHPUnit reporter also allows you to perform parameterization of the test case. To do this, you need to specify a dataprovider. Example:
    /**
     * @dataProvider additionProvider
     */
    public function testUsingProvider($a, $b, $expected)
    {
        $this->assertSame($expected, $a + $b);
    }
    public function additionProvider()
    {
        return [
            [0, 0, 0],
            [0, 1, 1],
            [1, 0, 1],
            [1, 1, 3]
        ];
    }Add to your phpunit.xml extension:
<extensions>
  <extension class="Qase\PHPUnit\Reporter"/>
</extensions>Reporter options (* - required):
QASE_REPORT- toggles sending reports to Qase.io, set1to enable- *
QASE_API_TOKEN- access token, you can find more information here. - *
QASE_PROJECT_CODE- code of your project (can be extracted from main page of your project, as example, forhttps://app.qase.io/project/DEMO->DEMOis project code here. QASE_API_BASE_URL- URL endpoint API from Qase TMS, default ishttps://api.qase.io/v1.QASE_RUN_ID- allows you to use an existing test run instead of creating new.QASE_RUN_COMPLETE- performs the "complete" function after passing the test run.QASE_ENVIRONMENT_ID- environment ID from Qase TMSQASE_LOGGING- toggles debug logging, set1to enable
The configuration file should be called phpunit.xml, an example of such a file:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
  <extensions>
    <extension class="Qase\PHPUnit\Reporter"/>
  </extensions>
  <testsuites>
    <testsuite name="qase-phpunit">
      <directory>./tests</directory>
    </testsuite>
  </testsuites>
  <php>
    <env name="QASE_REPORT" value="1"/>
    <env name="QASE_PROJECT_CODE" value="project_code"/>
    <env name="QASE_API_BASE_URL" value="https://api.qase.io/v1"/>
    <env name="QASE_API_TOKEN" value="api_key"/>
    <env name="QASE_ENVIRONMENT_ID" value="environment_id"/>
    <env name="QASE_RUN_COMPLETE" value="1"/>
    <env name="QASE_RUN_ID"/>
  </php>
</phpunit>
