Release 2.0.31 (#4245)
* replace strings by class references * allow 64 chars for username * fix time can be optional and null * fix timezone is not respected * bump version * fix br in attribute * support different visible duration from booked duration * fix image URL
This commit is contained in:
@@ -62,7 +62,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
|
||||
$this->assertStringContainsString('<input type="email"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_email" name="user_registration_form[email]" required="required"', $content);
|
||||
$this->assertStringContainsString('<input type="text"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_username" name="user_registration_form[username]" required="required" maxlength="60" pattern="', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_username" name="user_registration_form[username]" required="required" maxlength="64" pattern="', $content);
|
||||
$this->assertStringContainsString('<input type="password"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_plainPassword_first" name="user_registration_form[plainPassword][first]" required="required"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_plainPassword_second" name="user_registration_form[plainPassword][second]" required="required"', $content);
|
||||
|
||||
@@ -91,6 +91,22 @@ class UserTest extends TestCase
|
||||
{
|
||||
$user = new User();
|
||||
|
||||
$monday = new \DateTime('2023-05-08 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
$tuesday = new \DateTime('2023-05-09 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
$wednesday = new \DateTime('2023-05-10 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
$thursday = new \DateTime('2023-05-11 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
$friday = new \DateTime('2023-05-12 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
$saturday = new \DateTime('2023-05-13 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
$sunday = new \DateTime('2023-05-14 12:00:00', new \DateTimeZone('Europe/Berlin'));
|
||||
|
||||
self::assertFalse($user->isWorkDay($monday));
|
||||
self::assertFalse($user->isWorkDay($tuesday));
|
||||
self::assertFalse($user->isWorkDay($wednesday));
|
||||
self::assertFalse($user->isWorkDay($thursday));
|
||||
self::assertFalse($user->isWorkDay($friday));
|
||||
self::assertFalse($user->isWorkDay($saturday));
|
||||
self::assertFalse($user->isWorkDay($sunday));
|
||||
|
||||
$user->setWorkHoursMonday(7200);
|
||||
self::assertTrue($user->hasWorkHourConfiguration());
|
||||
$user->setWorkHoursTuesday(7300);
|
||||
@@ -111,13 +127,21 @@ class UserTest extends TestCase
|
||||
self::assertEquals(7800, $user->getWorkHoursSunday());
|
||||
self::assertEquals(10, $user->getHolidaysPerYear());
|
||||
|
||||
self::assertEquals(7200, $user->getWorkHoursForDay(new \DateTime('2023-05-08 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7300, $user->getWorkHoursForDay(new \DateTime('2023-05-09 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7400, $user->getWorkHoursForDay(new \DateTime('2023-05-10 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7500, $user->getWorkHoursForDay(new \DateTime('2023-05-11 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7600, $user->getWorkHoursForDay(new \DateTime('2023-05-12 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7700, $user->getWorkHoursForDay(new \DateTime('2023-05-13 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7800, $user->getWorkHoursForDay(new \DateTime('2023-05-14 12:00:00', new \DateTimeZone('Europe/Berlin'))));
|
||||
self::assertEquals(7200, $user->getWorkHoursForDay($monday));
|
||||
self::assertEquals(7300, $user->getWorkHoursForDay($tuesday));
|
||||
self::assertEquals(7400, $user->getWorkHoursForDay($wednesday));
|
||||
self::assertEquals(7500, $user->getWorkHoursForDay($thursday));
|
||||
self::assertEquals(7600, $user->getWorkHoursForDay($friday));
|
||||
self::assertEquals(7700, $user->getWorkHoursForDay($saturday));
|
||||
self::assertEquals(7800, $user->getWorkHoursForDay($sunday));
|
||||
|
||||
self::assertTrue($user->isWorkDay($monday));
|
||||
self::assertTrue($user->isWorkDay($tuesday));
|
||||
self::assertTrue($user->isWorkDay($wednesday));
|
||||
self::assertTrue($user->isWorkDay($thursday));
|
||||
self::assertTrue($user->isWorkDay($friday));
|
||||
self::assertTrue($user->isWorkDay($saturday));
|
||||
self::assertTrue($user->isWorkDay($sunday));
|
||||
|
||||
$user->setPublicHolidayGroup('10');
|
||||
self::assertEquals('10', $user->getPublicHolidayGroup());
|
||||
|
||||
@@ -25,14 +25,14 @@ class UserValidationTest extends KernelTestCase
|
||||
return [
|
||||
['', ''],
|
||||
['x', 'test@'], // too short username
|
||||
[str_pad('#', 61, '-'), 'test@x.'], // too long username
|
||||
[str_pad('#', 65, '-'), 'test@x.'], // too long username
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getInvalidTestData
|
||||
*/
|
||||
public function testInvalidValues($username, $email, $roles = [])
|
||||
public function testInvalidValues($username, $email, $roles = []): void
|
||||
{
|
||||
$defaultFields = [
|
||||
'username', 'email'
|
||||
@@ -49,7 +49,7 @@ class UserValidationTest extends KernelTestCase
|
||||
$this->assertHasViolationForField($user, $defaultFields, ['Profile']);
|
||||
}
|
||||
|
||||
public function testInvalidRoles()
|
||||
public function testInvalidRoles(): void
|
||||
{
|
||||
$user = new User();
|
||||
$user->setUserIdentifier('foo');
|
||||
@@ -59,7 +59,7 @@ class UserValidationTest extends KernelTestCase
|
||||
$this->assertHasViolationForField($user, ['roles'], ['RolesUpdate']);
|
||||
}
|
||||
|
||||
public function testValidRoles()
|
||||
public function testValidRoles(): void
|
||||
{
|
||||
$user = new User();
|
||||
$user->setUserIdentifier('foo');
|
||||
@@ -73,14 +73,14 @@ class UserValidationTest extends KernelTestCase
|
||||
{
|
||||
return [
|
||||
[str_pad('#', 8, '-'), 'test@x.x'], // shortest possible username
|
||||
[str_pad('#', 60, '-'), 'test@x.x'], // longest possible username
|
||||
[str_pad('#', 64, '-'), 'test@x.x'], // longest possible username
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getValidTestData
|
||||
*/
|
||||
public function testValidValues($username, $email, $roles = [])
|
||||
public function testValidValues($username, $email, $roles = []): void
|
||||
{
|
||||
$user = new User();
|
||||
$user->setUserIdentifier($username);
|
||||
|
||||
34
tests/WorkingTime/Model/DayAddonTest.php
Normal file
34
tests/WorkingTime/Model/DayAddonTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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\WorkingTime\Model;
|
||||
|
||||
use App\WorkingTime\Model\DayAddon;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\WorkingTime\Model\DayAddon
|
||||
*/
|
||||
class DayAddonTest extends TestCase
|
||||
{
|
||||
public function testDefaults(): void
|
||||
{
|
||||
$sut = new DayAddon('foo-bar', 7200, 0);
|
||||
self::assertEquals('foo-bar', $sut->getTitle());
|
||||
self::assertEquals(7200, $sut->getDuration());
|
||||
self::assertEquals(0, $sut->getVisibleDuration());
|
||||
self::assertTrue($sut->isBillable());
|
||||
|
||||
$sut->setBillable(false);
|
||||
self::assertFalse($sut->isBillable());
|
||||
|
||||
$sut->setBillable(true);
|
||||
self::assertTrue($sut->isBillable());
|
||||
}
|
||||
}
|
||||
@@ -4472,16 +4472,6 @@ parameters:
|
||||
count: 1
|
||||
path: Entity/UserValidationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Entity\\\\UserValidationTest\\:\\:testInvalidRoles\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Entity/UserValidationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Entity\\\\UserValidationTest\\:\\:testInvalidValues\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Entity/UserValidationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Entity\\\\UserValidationTest\\:\\:testInvalidValues\\(\\) has parameter \\$email with no type specified\\.$#"
|
||||
count: 1
|
||||
@@ -4497,16 +4487,6 @@ parameters:
|
||||
count: 1
|
||||
path: Entity/UserValidationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Entity\\\\UserValidationTest\\:\\:testValidRoles\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Entity/UserValidationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Entity\\\\UserValidationTest\\:\\:testValidValues\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Entity/UserValidationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Entity\\\\UserValidationTest\\:\\:testValidValues\\(\\) has parameter \\$email with no type specified\\.$#"
|
||||
count: 1
|
||||
|
||||
Reference in New Issue
Block a user