classValidator
final class Validator
Validates the clause grammar published at https://alistairmavin.com/ears/.
A statement is an optional feature (Where), preconditions (While), at most one trigger (When or If) and one system response. Quoted and code literals are masked first, so keywords inside them do not count as clauses.
Methods§
public function validate(string $statement): voidChecks that a statement follows the EARS clause grammar.
Parameters
$statement | string | The specification statement |
Throws
InvalidInputException When the statement breaks the grammar; the message starts with "EARS:"Test cases 20
ValidatorTest::testValidateAcceptsCardinalitycallsValidatorTest::testValidateAcceptsClauseOrdercallsValidatorTest::testValidateAcceptsComplexcallsValidatorTest::testValidateAcceptsComplexUnwantedBehaviourcallsValidatorTest::testValidateAcceptsEventDrivencallsValidatorTest::testValidateAcceptsLiteralscallsValidatorTest::testValidateAcceptsOptionalFeaturecallsValidatorTest::testValidateAcceptsStateDrivencallsValidatorTest::testValidateAcceptsSystemResponsecallsValidatorTest::testValidateAcceptsUnwantedBehaviourcallsValidatorTest::testValidateRejectsCardinalitycallsValidatorTest::testValidateRejectsClauseOrdercallsValidatorTest::testValidateRejectsComplexcallsValidatorTest::testValidateRejectsComplexUnwantedBehaviourcallsValidatorTest::testValidateRejectsEventDrivencallsValidatorTest::testValidateRejectsLiteralscallsValidatorTest::testValidateRejectsOptionalFeaturecallsValidatorTest::testValidateRejectsStateDrivencallsValidatorTest::testValidateRejectsSystemResponsecallsValidatorTest::testValidateRejectsUnwantedBehaviourcalls
Called from 1
Calls 11
- method-call LiteralMask::apply() line 27
- new LiteralMask line 27
- function-call
trimline 27 - function-call
preg_splitline 28 - new InvalidInputException line 30
- function-call
array_popline 32 - new ConditionOrder line 33
- method-call ConditionOrder::accept() line 35
- method-call SystemResponse::validate() line 37
- new SystemResponse line 37
- method-call ConditionOrder::trigger() line 37
Test cases 35§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 20
ValidatorTest::testValidateAcceptsCardinalitycallsValidatorTest::testValidateAcceptsClauseOrdercallsValidatorTest::testValidateAcceptsComplexcallsValidatorTest::testValidateAcceptsComplexUnwantedBehaviourcallsValidatorTest::testValidateAcceptsEventDrivencallsValidatorTest::testValidateAcceptsLiteralscallsValidatorTest::testValidateAcceptsOptionalFeaturecallsValidatorTest::testValidateAcceptsStateDrivencallsValidatorTest::testValidateAcceptsSystemResponsecallsValidatorTest::testValidateAcceptsUnwantedBehaviourcallsValidatorTest::testValidateRejectsCardinalitycallsValidatorTest::testValidateRejectsClauseOrdercallsValidatorTest::testValidateRejectsComplexcallsValidatorTest::testValidateRejectsComplexUnwantedBehaviourcallsValidatorTest::testValidateRejectsEventDrivencallsValidatorTest::testValidateRejectsLiteralscallsValidatorTest::testValidateRejectsOptionalFeaturecallsValidatorTest::testValidateRejectsStateDrivencallsValidatorTest::testValidateRejectsSystemResponsecallsValidatorTest::testValidateRejectsUnwantedBehaviourcalls
Other tests reaching this symbol 15
DefinitionReaderTestcallsLoaderTestcallsReferenceTestcallsMarkdownDocumentTestcallsApplicationTestcallsCommandHandlerTestcallsCommandLineTestcallsExecutorTestcallsFormatterTestcallsItemTestcallsItemValidatorTestcallsAnalyzerTestcallsCoverageTestcallsSnapshotTestcallsVerifierTestcalls