Modules

abstract Kohana_Unittest_TestSuite
extends PHPUnit_Framework_TestSuite
extends Kodoc_Missing
extends Kohana_Kodoc_Missing

This class is a transparent base class for Unittest_TestSuite and should not be accessed directly.

A version of the stock PHPUnit testsuite that supports whitelisting and blacklisting for code coverage filter[!!] This class, or a class parent, could not be found or loaded. This could be caused by a missing module or other dependancy. The documentation for class may not be complete!

Class declared in MODPATH/unittest/classes/Kohana/Unittest/TestSuite.php on line 7.

Properties

protected array $_filter_calls

Holds the details of files that should be white and blacklisted for code coverage

Default value:
array(3) (
    "addFileToBlacklist" => array(0) 
    "addDirectoryToBlacklist" => array(0) 
    "addFileToWhitelist" => array(0) 
)

Methods

public addDirectoryToBlacklist( string $dir ) (defined in Kohana_Unittest_TestSuite)

Queues a directory to be added to the code coverage blacklist when the suite runs

Parameters

  • string $dir required - $dir

Source Code

public function addDirectoryToBlacklist($dir)
{
    $this->_filter_calls['addDirectoryToBlacklist'][] = $dir;
}

public addFileToBlacklist( string $file ) (defined in Kohana_Unittest_TestSuite)

Queues a file to be added to the code coverage blacklist when the suite runs

Parameters

  • string $file required - $file

Source Code

public function addFileToBlacklist($file)
{
    $this->_filter_calls['addFileToBlacklist'][] = $file;
}

public addFileToWhitelist( string $file ) (defined in Kohana_Unittest_TestSuite)

Queues a file to be added to the code coverage whitelist when the suite runs

Parameters

  • string $file required - $file

Source Code

public function addFileToWhitelist($file)
{
    $this->_filter_calls['addFileToWhitelist'][] = $file;
}

public run( [ PHPUnit_Framework_TestResult $result = NULL , mixed $filter = bool FALSE , array $groups = array(0) , array $excludeGroups = array(0) , boolean $processIsolation = bool FALSE ] ) (defined in Kohana_Unittest_TestSuite)

Runs the tests and collects their result in a TestResult.

Parameters

  • PHPUnit_Framework_TestResult $result = NULL - $result
  • mixed $filter = bool FALSE - $filter
  • array $groups = array(0) - $groups
  • array $excludeGroups = array(0) - $excludeGroups
  • boolean $processIsolation = bool FALSE - $processIsolation

Tags

Return Values

  • PHPUnit_Framework_TestResult

Source Code

public function run(PHPUnit_Framework_TestResult $result = null, $filter = false, array $groups = [], array $excludeGroups = [], $processIsolation = false)
{

    // Get the code coverage filter from the suite's result object
    $coverage = $result->getCodeCoverage();

    if ($coverage) {
        $coverage_filter = $coverage->filter();

        // Apply the white and blacklisting
        foreach ($this->_filter_calls as $method => $args) {
            foreach ($args as $arg) {
                $coverage_filter->$method($arg);
            }
        }
    }

    return parent::run($result, $filter, $groups, $excludeGroups, $processIsolation);
}

public static create_class( string $class ) (defined in Kohana_Kodoc_Missing)

Creates classes when they are otherwise not found.

Kodoc::create_class('ThisClassDoesNotExist');

All classes created will extend Kodoc_Missing.

Parameters

  • string $class required - Class name

Tags

  • Since - 3.0.7

Return Values

  • boolean

Source Code

public static function create_class($class)
{
    if (!class_exists($class)) {
        // Create a new missing class
        eval("class {$class} extends Kodoc_Missing {}");
    }

    return true;
}