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
56 lines
2.0 KiB
PHP
56 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace YakNet\AccessibilityConsole\Tests\Parser;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use YakNet\AccessibilityConsole\Parser\TemplatePreprocessor;
|
|
|
|
class TemplatePreprocessorTest extends TestCase
|
|
{
|
|
private TemplatePreprocessor $preprocessor;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->preprocessor = new TemplatePreprocessor();
|
|
}
|
|
|
|
public function testPreprocessesBladeTemplate(): void
|
|
{
|
|
$blade = "<div>\n@if(true)\n<h1>{{ title }}</h1>\n@endif\n</div>";
|
|
$processed = $this->preprocessor->preprocess($blade, 'views/user.blade.php');
|
|
|
|
$this->assertStringNotContainsString('@if', $processed);
|
|
$this->assertStringNotContainsString('{{', $processed);
|
|
$this->assertStringContainsString('<h1>', $processed);
|
|
|
|
// Verify line count is preserved
|
|
$this->assertSame(substr_count($blade, "\n"), substr_count($processed, "\n"));
|
|
}
|
|
|
|
public function testPreprocessesTwigTemplate(): void
|
|
{
|
|
$twig = "<div>\n{% if logged_in %}\n<p>{{ user.email }}</p>\n{% endif %}\n</div>";
|
|
$processed = $this->preprocessor->preprocess($twig, 'templates/user.twig');
|
|
|
|
$this->assertStringNotContainsString('{%', $processed);
|
|
$this->assertStringNotContainsString('{{', $processed);
|
|
$this->assertStringContainsString('<p>', $processed);
|
|
|
|
// Verify line count is preserved
|
|
$this->assertSame(substr_count($twig, "\n"), substr_count($processed, "\n"));
|
|
}
|
|
|
|
public function testPreprocessesPhpTemplate(): void
|
|
{
|
|
$php = "<div>\n<?php if (true): ?>\n<button><?= \$label ?></button>\n<?php endif; ?>\n</div>";
|
|
$processed = $this->preprocessor->preprocess($php, 'views/button.php');
|
|
|
|
$this->assertStringNotContainsString('<?php', $processed);
|
|
$this->assertStringNotContainsString('<?=', $processed);
|
|
$this->assertStringContainsString('<button>', $processed);
|
|
|
|
// Verify line count is preserved
|
|
$this->assertSame(substr_count($php, "\n"), substr_count($processed, "\n"));
|
|
}
|
|
}
|