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.1 KiB
PHP
56 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace YakNet\AccessibilityConsole\Tests\Notifications;
|
|
|
|
use GuzzleHttp\Client;
|
|
use GuzzleHttp\Handler\MockHandler;
|
|
use GuzzleHttp\HandlerStack;
|
|
use GuzzleHttp\Middleware;
|
|
use GuzzleHttp\Psr7\Response;
|
|
use PHPUnit\Framework\TestCase;
|
|
use YakNet\AccessibilityConsole\Notifications\GenericWebhookNotifier;
|
|
use YakNet\AccessibilityConsole\Notifications\MicrosoftTeamsNotifier;
|
|
use YakNet\AccessibilityConsole\Notifications\NotificationPayload;
|
|
|
|
class ExpandedNotifiersTest extends TestCase
|
|
{
|
|
public function testMicrosoftTeamsNotifierPostsMessageCard(): void
|
|
{
|
|
$container = [];
|
|
$history = Middleware::history($container);
|
|
$mock = new MockHandler([new Response(200, [], '1')]);
|
|
$stack = HandlerStack::create($mock);
|
|
$stack->push($history);
|
|
$client = new Client(['handler' => $stack]);
|
|
|
|
$notifier = new MicrosoftTeamsNotifier('https://teams.example.test/webhook', $client);
|
|
$payload = new NotificationPayload('views/', 94, 2, 0, 2);
|
|
|
|
$this->assertTrue($notifier->send($payload));
|
|
$this->assertCount(1, $container);
|
|
$body = (string)$container[0]['request']->getBody();
|
|
$this->assertStringContainsString('MessageCard', $body);
|
|
$this->assertStringContainsString('YakNet Accessibility Console', $body);
|
|
}
|
|
|
|
public function testGenericWebhookNotifierSignsPayloadWithHmacSha256(): void
|
|
{
|
|
$container = [];
|
|
$history = Middleware::history($container);
|
|
$mock = new MockHandler([new Response(202, [], '{"ok":true}')]);
|
|
$stack = HandlerStack::create($mock);
|
|
$stack->push($history);
|
|
$client = new Client(['handler' => $stack]);
|
|
|
|
$notifier = new GenericWebhookNotifier('https://hooks.example.test/a11y', 'super-secret-key', $client);
|
|
$payload = new NotificationPayload('templates/', 88, 3, 1, 2);
|
|
|
|
$this->assertTrue($notifier->send($payload));
|
|
$this->assertCount(1, $container);
|
|
$sigHeader = $container[0]['request']->getHeaderLine('X-YakNet-Signature-256');
|
|
$this->assertStringStartsWith('sha256=', $sigHeader);
|
|
}
|
|
}
|