mirror of
https://github.com/kevinpapst/kimai2.git
synced 2025-04-30 07:20:11 +00:00

- Added: calendar entry title combination for customer, project and activity - Added: show not_invoiced and not_exported data in detail screens - Added: force logout if user is disabled - Added: reduced amount of database queries on several screens - Fixed: open-close status on work-contract screen for users without configuration - Fixed: failsafe order/orderBy in query if manually manipulated to be null - Fixed: unify statistic calculation (not_invoiced and not_exported) across screens - Tech: bump packages - Tech: Symfony 6.4
56 lines
1.4 KiB
PHP
56 lines
1.4 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\Event;
|
|
|
|
use App\Entity\User;
|
|
use App\Entity\UserPreference;
|
|
use App\Event\UserPreferenceEvent;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* @covers \App\Event\UserPreferenceEvent
|
|
*/
|
|
class UserPreferenceEventTest extends TestCase
|
|
{
|
|
public function testGetterAndSetter(): void
|
|
{
|
|
$user = new User();
|
|
$user->setAlias('foo');
|
|
$pref = new UserPreference('foo', 'bar');
|
|
|
|
$sut = new UserPreferenceEvent($user, []);
|
|
|
|
$this->assertEquals($user, $sut->getUser());
|
|
$this->assertTrue($sut->isBooting());
|
|
$this->assertEquals([], $sut->getPreferences());
|
|
|
|
$sut->addPreference($pref);
|
|
|
|
$this->assertEquals([$pref], $sut->getPreferences());
|
|
|
|
$sut = new UserPreferenceEvent($user, [], false);
|
|
$this->assertFalse($sut->isBooting());
|
|
}
|
|
|
|
public function testDuplicatePreferenceThrowsException(): void
|
|
{
|
|
$this->expectException(\InvalidArgumentException::class);
|
|
|
|
$user = new User();
|
|
$user->setAlias('foo');
|
|
$pref = new UserPreference('foo', 'bar');
|
|
$pref2 = new UserPreference('foo', 'hello');
|
|
|
|
$sut = new UserPreferenceEvent($user, []);
|
|
|
|
$sut->addPreference($pref);
|
|
$sut->addPreference($pref2);
|
|
}
|
|
}
|