You Are Here: Home Documentation API Reference getScenario

Enhance PHP Unit Testing And Mocking Framework improve the quality

getScenario

\Enhance\Core::getScenario($class, $methodname);

Creates a repeatable scenario for multiple tests to be run against with different parameters.

Parameters

Class $class

The class containing the method to be tested - or a class wrapped in code coverage wrapper.

String $methodName

The name of the method to be called.

Example Usage

$target = \Enhance\Core::getCodeCoverageWrapper('TaxCalculator');
$scenario = \Enhance\Core::getScenario($target, 'getIncomeTax');
$scenario->with($customer, $taxBandA)->expect(342.45);
$scenario->with($customer, $taxBandB)->expect(765.43);

See Scenario Testing .