phpunitscrutinizer

Scrutinizer - skip some phpunits


I want to skip some phpunit tests in scrutinizer.

How can I achive the same?

Where do I need to do configuration changes for the same?


Solution

  • Many CI systems incl. Scrutinizer CI set environment variables in their build environment.

    For example the environment variable SCRUTINIZER is set to TRUE. That is only one of many, learn more about Pre-defined Environment Variables on Scrutinizer CI.

    Inside the test method (or inside the setUp() method for the whole class) you can check the environment variable (e.g. via $_ENV) and mark the test as skipped.

    if (isset($_ENV['SCRUTINIZER'])) {
        $this->markTestSkipped(
            'Scrutinizer CI build'
        );
    }
    

    See as well the more general question How to skip tests in PHPunit? and the Phpunit documentation Incomplete and Skipped Tests.