Release 2.38.0 (#5563)

This commit is contained in:
Kevin Papst
2025-08-08 23:25:42 +02:00
committed by GitHub
parent f3890691ce
commit 04331420ae
88 changed files with 1319 additions and 697 deletions

View File

@@ -0,0 +1,47 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Webhook\Attribute;
use App\Entity\Invoice;
use App\Event\InvoiceDeleteEvent;
use App\Webhook\Attribute\AsWebhook;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Webhook\Attribute\AsWebhook
*/
class AsWebhookTestCase extends TestCase
{
public function testConstruct(): void
{
$attribute = new AsWebhook('name', 'description', 'some payload');
self::assertEquals('name', $attribute->name);
self::assertEquals('description', $attribute->description);
self::assertEquals('some payload', $attribute->payload);
}
public function testUsage(): void
{
$invoice = new Invoice();
$invoice->setComment('foo bar');
$usage = new InvoiceDeleteEvent($invoice);
$ref = new \ReflectionClass($usage);
$attr = $ref->getAttributes(AsWebhook::class);
self::assertCount(1, $attr);
$arguments = $attr[0]->getArguments();
self::assertEquals('invoice.deleted', $arguments['name']);
self::assertEquals('Triggered after an invoice was deleted', $arguments['description']);
self::assertEquals('object.getInvoice()', $arguments['payload']);
}
}