Gherkin
extends Test
in package
implements
ScenarioDriven, Reported
The most simple testcase (with only one test in it) which can be executed by PHPUnit/Codeception.
It can be extended with included traits. Turning on/off a trait should not break class functionality.
Class has exactly one method to be executed for testing, wrapped with before/after callbacks delivered from included traits.
A trait providing before/after callback should contain corresponding protected methods: {traitName}Start
and {traitName}End
,
then this trait should be enabled in hooks
property.
Inherited class must implement test
method.
Table of Contents
Interfaces
Constants
- STATUS_ERROR = 'error'
- STATUS_FAIL = 'fail'
- STATUS_OK = 'ok'
- STATUS_PENDING = 'pending'
Properties
- $featureNode : FeatureNode
- $hooks : array<string|int, mixed>
- Enabled traits with methods to be called before and after the test.
- $numAssertions : mixed
- $scenario : Scenario
- $scenarioNode : ScenarioNode
- $steps : mixed
- $ignored : mixed
- $metadata : Metadata
- $testResult : mixed
Methods
- __construct() : mixed
- addToAssertionCount() : mixed
- This method is not covered by the backward compatibility promise for PHPUnit, but is nice to have for extensions.
- codeCoverageEnd() : mixed
- codeCoverageStart() : mixed
- count() : mixed
- errorLoggerEnd() : mixed
- getFeature() : mixed
- getFeatureNode() : FeatureNode
- getFileName() : mixed
- getMetadata() : mixed
- getName() : mixed
- getNumAssertions() : mixed
- getReportFields() : array<string|int, mixed>
- Field values for XML/JSON/TAP reports
- getScenario() : Scenario
- getScenarioNode() : ScenarioNode
- getScenarioText() : mixed
- getScenarioTitle() : mixed
- getSignature() : mixed
- getSourceCode() : mixed
- getTestResultObject() : mixed
- preload() : mixed
- run() : TestResult
- Runs a test and collects its result in a TestResult instance.
- test() : mixed
- Everything inside this method is treated as a test.
- toString() : mixed
- Test representation
- assertionCounterEnd() : mixed
- assertionCounterStart() : mixed
- ignore() : mixed
- Should a test be skipped (can be set from hooks)
- ignoreIfMetadataBlockedStart() : mixed
- makeContexts() : mixed
- runStep() : mixed
- setMetadata() : mixed
- validateStep() : mixed
- contextAsString() : mixed
Constants
STATUS_ERROR
public
mixed
STATUS_ERROR
= 'error'
STATUS_FAIL
public
mixed
STATUS_FAIL
= 'fail'
STATUS_OK
public
mixed
STATUS_OK
= 'ok'
STATUS_PENDING
public
mixed
STATUS_PENDING
= 'pending'
Properties
$featureNode
protected
FeatureNode
$featureNode
$hooks
Enabled traits with methods to be called before and after the test.
protected
array<string|int, mixed>
$hooks
= ['ignoreIfMetadataBlocked', 'codeCoverage', 'assertionCounter', 'errorLogger']
$numAssertions
protected
mixed
$numAssertions
= 0
$scenario
protected
Scenario
$scenario
$scenarioNode
protected
ScenarioNode
$scenarioNode
$steps
protected
mixed
$steps
= []
$ignored
private
mixed
$ignored
= false
$metadata
private
Metadata
$metadata
$testResult
private
mixed
$testResult
Methods
__construct()
public
__construct(FeatureNode $featureNode, ScenarioInterface $scenarioNode[, mixed $steps = [] ]) : mixed
Parameters
- $featureNode : FeatureNode
- $scenarioNode : ScenarioInterface
- $steps : mixed = []
addToAssertionCount()
This method is not covered by the backward compatibility promise for PHPUnit, but is nice to have for extensions.
public
addToAssertionCount(mixed $count) : mixed
Parameters
- $count : mixed
codeCoverageEnd()
public
codeCoverageEnd(mixed $status, mixed $time) : mixed
Parameters
- $status : mixed
- $time : mixed
codeCoverageStart()
public
codeCoverageStart() : mixed
count()
public
count() : mixed
Attributes
errorLoggerEnd()
public
errorLoggerEnd(mixed $status, mixed $time[, mixed $exception = null ]) : mixed
Parameters
- $status : mixed
- $time : mixed
- $exception : mixed = null
getFeature()
public
getFeature() : mixed
getFeatureNode()
public
getFeatureNode() : FeatureNode
Return values
FeatureNodegetFileName()
public
getFileName() : mixed
getMetadata()
public
getMetadata() : mixed
getName()
public
getName() : mixed
getNumAssertions()
public
getNumAssertions() : mixed
getReportFields()
Field values for XML/JSON/TAP reports
public
getReportFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getScenario()
public
getScenario() : Scenario
Return values
ScenariogetScenarioNode()
public
getScenarioNode() : ScenarioNode
Return values
ScenarioNodegetScenarioText()
public
getScenarioText([mixed $format = 'text' ]) : mixed
Parameters
- $format : mixed = 'text'
getScenarioTitle()
public
getScenarioTitle() : mixed
getSignature()
public
getSignature() : mixed
getSourceCode()
public
getSourceCode() : mixed
getTestResultObject()
public
getTestResultObject() : mixed
preload()
public
preload() : mixed
run()
Runs a test and collects its result in a TestResult instance.
public
final run([TestResult $result = null ]) : TestResult
Executes before/after hooks coming from traits.
Parameters
- $result : TestResult = null
Return values
TestResulttest()
Everything inside this method is treated as a test.
public
test() : mixed
toString()
Test representation
public
toString() : mixed
assertionCounterEnd()
protected
assertionCounterEnd() : mixed
assertionCounterStart()
protected
assertionCounterStart() : mixed
ignore()
Should a test be skipped (can be set from hooks)
protected
ignore(bool $ignored) : mixed
Parameters
- $ignored : bool
ignoreIfMetadataBlockedStart()
protected
ignoreIfMetadataBlockedStart() : mixed
makeContexts()
protected
makeContexts() : mixed
runStep()
protected
runStep(StepNode $stepNode) : mixed
Parameters
- $stepNode : StepNode
setMetadata()
protected
setMetadata(Metadata $metadata) : mixed
Parameters
- $metadata : Metadata
validateStep()
protected
validateStep(StepNode $stepNode) : mixed
Parameters
- $stepNode : StepNode
contextAsString()
private
contextAsString(mixed $context) : mixed
Parameters
- $context : mixed