Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat(v4.0.0): 175 WCAG 2.2 & ARIA rules, VPAT 2.5, 11 presets, PolicyEngine, inline suppressions, cache, CI generator, PHPUnit assertions, and open-source YakNet identity
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Tests\Policy;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use YakNet\AccessibilityConsole\Core\Severity;
|
||||
use YakNet\AccessibilityConsole\Core\Violation;
|
||||
use YakNet\AccessibilityConsole\Core\WCAGStandard;
|
||||
use YakNet\AccessibilityConsole\Policy\PolicyEngine;
|
||||
|
||||
class PolicyEngineTest extends TestCase
|
||||
{
|
||||
public function testPolicyPassesWhenWithinThresholds(): void
|
||||
{
|
||||
$engine = new PolicyEngine([
|
||||
'min_score' => 90,
|
||||
'max_errors' => 0,
|
||||
'max_warnings' => 2,
|
||||
'required_standards' => ['A'],
|
||||
]);
|
||||
|
||||
$violations = [
|
||||
new Violation('WCAG_2_5_8_TARGET_SIZE', 'Small button', Severity::WARNING, WCAGStandard::AA),
|
||||
];
|
||||
|
||||
$result = $engine->evaluate($violations);
|
||||
$this->assertTrue($result->passed);
|
||||
$this->assertEmpty($result->failures);
|
||||
}
|
||||
|
||||
public function testPolicyEnforcesAllGovernanceGatesAndSeverityOverrides(): void
|
||||
{
|
||||
$engine = new PolicyEngine([
|
||||
'min_score' => 95,
|
||||
'max_critical' => 0,
|
||||
'required_standards' => ['AA'],
|
||||
'banned_rules' => ['WCAG_1_1_1_ALT'],
|
||||
'principle_limits' => ['Perceivable' => 0],
|
||||
'severity_overrides' => [
|
||||
'WCAG_2_5_8_TARGET_SIZE' => 'critical',
|
||||
],
|
||||
]);
|
||||
|
||||
$v1 = new Violation('WCAG_1_1_1_ALT', 'Missing alt', Severity::ERROR, WCAGStandard::A);
|
||||
$v2 = new Violation('WCAG_2_5_8_TARGET_SIZE', 'Small target', Severity::WARNING, WCAGStandard::AA);
|
||||
|
||||
$result = $engine->evaluate([$v1, $v2]);
|
||||
|
||||
$this->assertFalse($result->passed);
|
||||
$this->assertSame(Severity::CRITICAL, $v2->severity);
|
||||
$this->assertGreaterThanOrEqual(4, count($result->failures));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user