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
This commit is contained in:
63
tests/Calendar/CalendarQueryTest.php
Normal file
63
tests/Calendar/CalendarQueryTest.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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\Calendar;
|
||||
|
||||
use App\Calendar\CalendarQuery;
|
||||
use App\Entity\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(CalendarQuery::class)]
|
||||
class CalendarQueryTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$sut = new CalendarQuery();
|
||||
|
||||
self::assertNull($sut->getDate());
|
||||
self::assertNull($sut->getUser());
|
||||
self::assertEquals('month', $sut->getView());
|
||||
|
||||
$user = new User();
|
||||
$sut->setUser($user);
|
||||
self::assertSame($user, $sut->getUser());
|
||||
|
||||
$date = new \DateTimeImmutable('2025-08-13 12:13:14');
|
||||
$sut->setDate($date);
|
||||
self::assertNotNull($sut->getDate());
|
||||
self::assertEquals('2025-08-13 12:13:14', $sut->getDate()->format('Y-m-d H:i:s'));
|
||||
|
||||
$sut->setView('foo');
|
||||
self::assertEquals('month', $sut->getView());
|
||||
}
|
||||
|
||||
#[DataProvider('getTestData')]
|
||||
public function testSetView(string $value, string $expected): void
|
||||
{
|
||||
$sut = new CalendarQuery();
|
||||
$sut->setView($value);
|
||||
self::assertEquals($expected, $sut->getView());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return iterable<int, array<int, string>>
|
||||
*/
|
||||
public static function getTestData(): iterable
|
||||
{
|
||||
yield ['agendaMonth', 'month'];
|
||||
yield ['agendaWeek', 'week'];
|
||||
yield ['agendaDay', 'day'];
|
||||
yield ['month', 'month'];
|
||||
yield ['week', 'week'];
|
||||
yield ['day', 'day'];
|
||||
yield ['foo', 'month'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user