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,118 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Tests\Console;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use YakNet\AccessibilityConsole\Console\Command\CompareCommand;
|
||||
use YakNet\AccessibilityConsole\Console\Command\DoctorCommand;
|
||||
use YakNet\AccessibilityConsole\Console\Command\ExplainCommand;
|
||||
use YakNet\AccessibilityConsole\Console\Command\PresetsCommand;
|
||||
use YakNet\AccessibilityConsole\Console\Command\RulesCommand;
|
||||
use YakNet\AccessibilityConsole\Console\Command\VpatCommand;
|
||||
|
||||
class V4CommandsTest extends TestCase
|
||||
{
|
||||
public function testDoctorCommandPasses(): void
|
||||
{
|
||||
$tester = new CommandTester(new DoctorCommand());
|
||||
$exitCode = $tester->execute([]);
|
||||
|
||||
$this->assertSame(0, $exitCode);
|
||||
$output = $tester->getDisplay();
|
||||
$this->assertStringContainsString('175 rules registered', $output);
|
||||
$this->assertStringContainsString('VALID (0 conflicts)', $output);
|
||||
$this->assertStringContainsString('11 profiles available', $output);
|
||||
}
|
||||
|
||||
public function testExplainCommandDisplaysRuleAndWcagGuidance(): void
|
||||
{
|
||||
$tester = new CommandTester(new ExplainCommand());
|
||||
$exitCode = $tester->execute(['rule' => 'WCAG_4_1_2_ARIA_TABLIST']);
|
||||
|
||||
$this->assertSame(0, $exitCode);
|
||||
$output = $tester->getDisplay();
|
||||
$this->assertStringContainsString('WCAG_4_1_2_ARIA_TABLIST', $output);
|
||||
$this->assertStringContainsString('W3C WCAG Guidance', $output);
|
||||
$this->assertStringContainsString('Non-Compliant Example', $output);
|
||||
}
|
||||
|
||||
public function testPresetsCommandListsAllElevenPresets(): void
|
||||
{
|
||||
$tester = new CommandTester(new PresetsCommand());
|
||||
$exitCode = $tester->execute([]);
|
||||
|
||||
$this->assertSame(0, $exitCode);
|
||||
$output = $tester->getDisplay();
|
||||
$this->assertStringContainsString('wcag22-aa', $output);
|
||||
$this->assertStringContainsString('eaa2025', $output);
|
||||
$this->assertStringContainsString('government', $output);
|
||||
$this->assertStringContainsString('Total compliance presets available: 11', $output);
|
||||
}
|
||||
|
||||
public function testRulesCommandHealableAndPrincipleFilters(): void
|
||||
{
|
||||
$tester = new CommandTester(new RulesCommand());
|
||||
$exitCode = $tester->execute(['--healable' => true]);
|
||||
|
||||
$this->assertSame(0, $exitCode);
|
||||
$output = $tester->getDisplay();
|
||||
$this->assertStringContainsString('WCAG_3_2_2_BUTTON_TYPE', $output);
|
||||
$this->assertStringContainsString('Showing', $output);
|
||||
|
||||
$exitCode2 = $tester->execute(['--principle' => 'Operable']);
|
||||
$this->assertSame(0, $exitCode2);
|
||||
$this->assertStringContainsString('WCAG_2_', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testVpatCommandOutputsMarkdownReport(): void
|
||||
{
|
||||
$tmpHtml = sys_get_temp_dir() . '/yaknet_vpat_' . uniqid() . '.html';
|
||||
file_put_contents($tmpHtml, '<!DOCTYPE html><html lang="en"><head><title>Demo</title></head><body><main><h1>Hello</h1><img src="x.png"></main></body></html>');
|
||||
|
||||
try {
|
||||
$tester = new CommandTester(new VpatCommand());
|
||||
$exitCode = $tester->execute([
|
||||
'target' => $tmpHtml,
|
||||
'--format' => 'markdown',
|
||||
'--product' => 'YakNet Demo',
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $exitCode);
|
||||
$output = $tester->getDisplay();
|
||||
$this->assertStringContainsString('# Accessibility Conformance Report (VPAT 2.5)', $output);
|
||||
$this->assertStringContainsString('YakNet Demo', $output);
|
||||
} finally {
|
||||
@unlink($tmpHtml);
|
||||
}
|
||||
}
|
||||
|
||||
public function testCompareCommandDetectsRegressionAndFailsWhenRequested(): void
|
||||
{
|
||||
$beforeFile = sys_get_temp_dir() . '/yaknet_before_' . uniqid() . '.json';
|
||||
$afterFile = sys_get_temp_dir() . '/yaknet_after_' . uniqid() . '.json';
|
||||
|
||||
file_put_contents($beforeFile, json_encode([]));
|
||||
file_put_contents($afterFile, json_encode([
|
||||
['ruleId' => 'WCAG_1_1_1_ALT', 'message' => 'Missing alt', 'severity' => 'error', 'htmlSnippet' => '<img src="new.png">', 'location' => ['file' => 'index.html', 'line' => 10]],
|
||||
]));
|
||||
|
||||
try {
|
||||
$tester = new CommandTester(new CompareCommand());
|
||||
$exitCode = $tester->execute([
|
||||
'before' => $beforeFile,
|
||||
'after' => $afterFile,
|
||||
'--fail-on-regression' => true,
|
||||
]);
|
||||
|
||||
$this->assertSame(1, $exitCode);
|
||||
$this->assertStringContainsString('REGRESSION', $tester->getDisplay());
|
||||
$this->assertStringContainsString('WCAG_1_1_1_ALT', $tester->getDisplay());
|
||||
} finally {
|
||||
@unlink($beforeFile);
|
||||
@unlink($afterFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user