addRule(new HeadingOrder());
$violations = $scanner->scan('
Main Heading
Skipped Subheading
');
$this->assertCount(1, $violations);
$this->assertSame('WCAG_1_3_1_HEADING', $violations[0]->ruleId);
}
public function testPassesSequentialHeadings(): void
{
$scanner = new Scanner();
$scanner->addRule(new HeadingOrder());
$violations = $scanner->scan('Main Heading
Section
Sub-section
');
$this->assertCount(0, $violations);
}
public function testIsStatelessAcrossMultipleScans(): void
{
$scanner = new Scanner();
$scanner->addRule(new HeadingOrder());
// First scan ends with H3
$scanner->scan('H1
H2
H3
');
// Second scan starts with H1, should not flag jump from previous scan's H3
$violations = $scanner->scan('Fresh Document H1
H2
');
$this->assertCount(0, $violations);
}
}