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,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use YakNet\AccessibilityConsole\Cache\ScanCache;
|
||||
use YakNet\AccessibilityConsole\CI\CiWorkflowGenerator;
|
||||
use YakNet\AccessibilityConsole\Core\Analyser;
|
||||
use YakNet\AccessibilityConsole\Core\BaselineManager;
|
||||
use YakNet\AccessibilityConsole\Core\Config;
|
||||
use YakNet\AccessibilityConsole\Core\Scanner;
|
||||
use YakNet\AccessibilityConsole\Rules\ImgAltText;
|
||||
use YakNet\AccessibilityConsole\Testing\AccessibilityAssertions;
|
||||
|
||||
class V4SymmetryModulesTest extends TestCase
|
||||
{
|
||||
use AccessibilityAssertions;
|
||||
|
||||
public function testScanCacheStoresAndServesHits(): void
|
||||
{
|
||||
$cacheFile = sys_get_temp_dir() . '/yaknet_cache_' . uniqid() . '.json';
|
||||
$htmlFile = sys_get_temp_dir() . '/yaknet_cached_page_' . uniqid() . '.html';
|
||||
file_put_contents($htmlFile, '<main><img src="a.png"></main>');
|
||||
|
||||
try {
|
||||
$scanner = new Scanner();
|
||||
$scanner->addRule(new ImgAltText());
|
||||
|
||||
// First run: cache miss & populate
|
||||
$cache1 = new ScanCache($cacheFile, 'sig-v1');
|
||||
$analyser1 = new Analyser(new Config(), $scanner, new BaselineManager(), null, null, null, $cache1);
|
||||
$res1 = $analyser1->analyse([$htmlFile]);
|
||||
$this->assertCount(1, $res1['violations']);
|
||||
$this->assertSame(0, $cache1->getStats()['hits']);
|
||||
$this->assertSame(1, $cache1->getStats()['misses']);
|
||||
|
||||
// Second run: cache hit!
|
||||
$cache2 = new ScanCache($cacheFile, 'sig-v1');
|
||||
$cache2->load();
|
||||
$analyser2 = new Analyser(new Config(), $scanner, new BaselineManager(), null, null, null, $cache2);
|
||||
$res2 = $analyser2->analyse([$htmlFile]);
|
||||
$this->assertCount(1, $res2['violations']);
|
||||
$this->assertSame(1, $cache2->getStats()['hits']);
|
||||
$this->assertSame(100.0, $cache2->getStats()['hit_rate']);
|
||||
} finally {
|
||||
@unlink($cacheFile);
|
||||
@unlink($htmlFile);
|
||||
}
|
||||
}
|
||||
|
||||
public function testCiWorkflowGeneratorSupportsAllFourPlatforms(): void
|
||||
{
|
||||
$generator = new CiWorkflowGenerator();
|
||||
|
||||
foreach (CiWorkflowGenerator::getSupportedPlatforms() as $platform) {
|
||||
$yaml = $generator->generate($platform, 'wcag22-aa', 95, 'templates');
|
||||
$this->assertStringContainsString('vendor/bin/a11y', $yaml);
|
||||
$this->assertStringContainsString('--preset=wcag22-aa', $yaml);
|
||||
$this->assertNotEmpty(CiWorkflowGenerator::getDefaultPath($platform));
|
||||
}
|
||||
}
|
||||
|
||||
public function testAccessibilityAssertionsTraitValidatesCleanHtml(): void
|
||||
{
|
||||
$cleanHtml = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>YakNet</title></head><body><main><h1>Welcome</h1><p>Accessible page.</p></main></body></html>';
|
||||
|
||||
$this->assertHtmlAccessible($cleanHtml, level: 4);
|
||||
$this->assertAccessibilityScoreAtLeast($cleanHtml, minScore: 95, level: 4);
|
||||
$this->assertMeetsAccessibilityPreset($cleanHtml, 'wcag22-aa');
|
||||
$this->assertNoAccessibilityRuleViolation($cleanHtml, 'WCAG_1_1_1_ALT');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user