Files
kimai2/tests/Event/TimesheetStatisticsQueryEventTest.php
Kevin Papst 77afa207e0 Allow to customize statistic queries (#5827)
* use TimesheetStatisticsQUery for all repository calls
* send event to customize statistics query
2026-02-24 13:27:48 +01:00

32 lines
928 B
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\Event;
use App\Event\TimesheetStatisticsQueryEvent;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\QueryBuilder;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(TimesheetStatisticsQueryEvent::class)]
class TimesheetStatisticsQueryEventTest extends TestCase
{
public function testGetter(): void
{
$qb = new QueryBuilder($this->createMock(EntityManager::class));
self::assertCount(0, $qb->getParameters());
$sut = new TimesheetStatisticsQueryEvent($qb);
$qb->setParameter('foo', 'bar');
self::assertSame($qb, $sut->getQueryBuilder());
self::assertCount(1, $sut->getQueryBuilder()->getParameters());
}
}