Files
kimai2/tests/Audit/LoggableTest.php
Kevin Papst a4d658b821 Release 2.39 (#5604)
* prepare audit via annotation
* default calendar slot label distance of 1h
+ replace freestyle config with dropdown
* added missing return definition in callbacks
* refactor view name handling
* dispatch calendar view changes and push them into the URL to be able to reload the poage
* bump packages
* fix timezone issue in calendar sum calculation
* fixes #5618 resetRates()
* show expected daily hours in working-contract screen
2025-08-30 11:41:17 +02:00

36 lines
1.1 KiB
PHP

<?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\Audit;
use App\Audit\Loggable;
use App\Entity\CustomerMeta;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Form\Test\TypeTestCase;
#[CoversClass(Loggable::class)]
class LoggableTest extends TypeTestCase
{
public function testConstruct(): void
{
$sut = new Loggable(CustomerMeta::class);
self::assertEquals(CustomerMeta::class, $sut->customFieldClass);
}
public function testHasAttributeAttributeOnLoggable(): void
{
$reflection = new \ReflectionClass(Loggable::class);
/** @var array<\ReflectionAttribute<\Attribute>> $attributes */
$attributes = array_filter($reflection->getAttributes(), fn ($attr) => $attr->getName() === \Attribute::class);
self::assertCount(1, $attributes, 'Loggable class should have the Attribute attribute');
$attribute = $attributes[0];
self::assertEquals(\Attribute::TARGET_CLASS, $attribute->getArguments()[0]);
}
}