element at the wrong level' => [
'sniffs' => 'StandardWithDocs.Unsupported.ElementAtWrongLevel',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputEmpty.txt',
],
'Unsupported: one correct elm, one at wrong level' => [
'sniffs' => 'StandardWithDocs.Unsupported.OneElmAtWrongLevel',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputUnsupportedOneElmAtWrongLevel.html',
],
'Unsupported: superfluous code element' => [
'sniffs' => 'StandardWithDocs.Unsupported.SuperfluousCodeElement',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputUnsupportedSuperfluousCodeElement.html',
],
'Unsupported: unknown element' => [
'sniffs' => 'StandardWithDocs.Unsupported.UnknownElement',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputEmpty.txt',
],
'Invalid: code comparison mismatched code elms' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeComparisonMismatchedCodeElms',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeComparisonMismatchedCodeElms.html',
],
'Invalid: code comparison only has one code elm' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeComparisonMissingCodeElm',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeComparisonMissingCodeElm.html',
],
'Invalid: code elements have no content' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeComparisonNoCode',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeComparisonNoCode.html',
],
'Invalid: code comparison element has no content' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeComparisonNoContent',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeComparisonNoContent.html',
],
'Invalid: code comparison two code elms, one empty' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeComparisonOneEmptyCodeElm',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeComparisonOneEmptyCodeElm.html',
],
'Invalid: code comparison two empty code elms' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeComparisonTwoEmptyCodeElms',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeComparisonTwoEmptyCodeElms.html',
],
'Invalid: code title attributes are empty' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeTitleEmpty',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeTitleEmpty.html',
],
'Invalid: code title attributes missing' => [
'sniffs' => 'StandardWithDocs.Invalid.CodeTitleMissing',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidCodeTitleMissing.html',
],
'Invalid: documentation title attribute is empty' => [
'sniffs' => 'StandardWithDocs.Invalid.DocumentationTitleEmpty',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidDocumentationTitleEmpty.html',
],
'Invalid: documentation title attribute missing' => [
'sniffs' => 'StandardWithDocs.Invalid.DocumentationTitleMissing',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidDocumentationTitleMissing.html',
],
'Invalid: standard element has no content' => [
'sniffs' => 'StandardWithDocs.Invalid.StandardNoContent',
'pathToExpected' => __DIR__.'/Expectations/ExpectedOutputInvalidStandardNoContent.html',
],
];
}//end dataDocSpecifics()
/**
* Test anchor links in the generated docs are slugified and unique.
*
* @return void
*/
public function testAnchorLinks()
{
// Set up the ruleset.
$standard = __DIR__.'/AnchorLinksTest.xml';
$config = new ConfigDouble(["--standard=$standard"]);
$ruleset = new Ruleset($config);
$pathToExpected = __DIR__.'/Expectations/ExpectedOutputDocumentationTitleToAnchorSlug.html';
$expected = file_get_contents($pathToExpected);
$this->assertNotFalse($expected, 'Output expectation file could not be found');
// Make the test OS independent.
$expected = str_replace("\n", PHP_EOL, $expected);
$this->expectOutputString($expected);
$generator = new HTMLDouble($ruleset);
$generator->generate();
}//end testAnchorLinks()
/**
* Test the generated footer.
*
* @return void
*/
public function testFooter()
{
// Set up the ruleset.
$standard = __DIR__.'/OneDocTest.xml';
$config = new ConfigDouble(["--standard=$standard"]);
$ruleset = new Ruleset($config);
$regex = '`^ ';
$regex .= 'Documentation generated on [A-Z][a-z]{2}, [0-9]{2} [A-Z][a-z]{2} 20[0-9]{2} [0-2][0-9](?::[0-5][0-9]){2} [+-][0-9]{4}';
$regex .= ' by PHP_CodeSniffer [3-9]\.[0-9]+.[0-9]+';
$regex .= '\R