Muted

Normal

HTML; $parsed = $parser->parse($html); $this->assertSame('Decorative hero sprite', $parser->getSuppressionReason($parsed, 'WCAG_1_1_1_ALT', 3)); $this->assertNull($parser->getSuppressionReason($parsed, 'WCAG_1_1_1_ALT', 4)); $this->assertSame('Brand theme', $parser->getSuppressionReason($parsed, 'WCAG_1_4_3_CONTRAST', 5)); $this->assertNull($parser->getSuppressionReason($parsed, 'WCAG_1_4_3_CONTRAST', 7)); } public function testAnalyserHonorsInlineSuppressionAndLogsAuditTrail(): void { $tmpFile = sys_get_temp_dir() . '/yaknet_suppression_' . uniqid() . '.html'; file_put_contents($tmpFile, "
\n\n\n\n
"); try { $scanner = new Scanner(); $scanner->addRule(new ImgAltText()); $analyser = new Analyser(new Config(), $scanner, new BaselineManager()); $result = $analyser->analyse([$tmpFile]); $this->assertCount(1, $result['violations']); $auditLog = $analyser->getSuppressedAuditLog(); $this->assertCount(1, $auditLog); $this->assertSame('WCAG_1_1_1_ALT', $auditLog[0]['ruleId']); $this->assertSame('Approved decorative', $auditLog[0]['reason']); } finally { @unlink($tmpFile); } } }