Modules

Unittest_TestSuite
extends Kohana_Unittest_TestSuite
extends PHPUnit\Framework\TestSuite
extends Kodoc_Missing
extends Kohana_Kodoc_Missing

A version of the stock PHPUnit testsuite that supports whitelisting 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/Unittest/TestSuite.php on line 3.

Constants

  • None

Properties

Properties

protected array $_filter_calls

Holds the details of files that should be whitelisted for code coverage

Default value:
array(1) (
    "addFileToWhitelist" => array(0) 
)

Methods

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 -

Source Code

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

public run( [ PHPUnit_Framework_TestResult $result = NULL ] ) (defined in Kohana_Unittest_TestSuite)

Runs the tests and collects their result in a TestResult.

Parameters

  • PHPUnit_Framework_TestResult $result = NULL - $result

Tags

Return Values

  • PHPUnit_Framework_TestResult

Source Code

public function run(TestResult $result = NULL): TestResult
{
 Get the code coverage filter from the suite's result object
overage = $result->getCodeCoverage();

 ($coverage)

coverage_filter = $coverage->filter();

/ Apply the white and blacklisting
oreach ($this->_filter_calls as $method => $args)

foreach ($args as $arg)
{
	$coverage_filter->$method($arg);
}



turn parent::run($result);

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
		if (FALSE === strpos($class, '\\'))
		{
			eval("class {$class} extends Kodoc_Missing {}");
		}
		else
		{
			$namespace = explode('\\', $class);
			$class = array_pop($namespace);
			eval("namespace ".implode('\\', $namespace)."; class {$class} extends \Kodoc_Missing {}");
		}
	}

	return TRUE;
}