Release 2.42 (#5686)

This commit is contained in:
Kevin Papst
2025-11-12 16:15:04 +01:00
committed by GitHub
parent ea29799b89
commit 8e6764b67a
42 changed files with 377 additions and 416 deletions

View File

@@ -0,0 +1,36 @@
<?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\Activity;
use App\Event\ActivityDeleteEvent;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(ActivityDeleteEvent::class)]
class ActivityDeleteEventTest extends AbstractActivityEventTestCase
{
protected function createActivityEvent(Activity $activity): ActivityDeleteEvent
{
return new ActivityDeleteEvent($activity);
}
public function testReplacement(): void
{
$activity = new Activity();
$activity->setName('activity 1');
$replacement = new Activity();
$replacement->setName('activity 2');
$sut = new ActivityDeleteEvent($activity, $replacement);
self::assertSame($activity, $sut->getActivity());
self::assertSame($replacement, $sut->getReplacementActivity());
}
}

View File

@@ -0,0 +1,35 @@
<?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\Customer;
use App\Event\AbstractCustomerEvent;
use App\Event\CustomerDeleteEvent;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(CustomerDeleteEvent::class)]
class CustomerDeleteEventTest extends AbstractCustomerEventTestCase
{
protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent
{
return new CustomerDeleteEvent($customer);
}
public function testReplacement(): void
{
$entity = new Customer('customer 1');
$replacement = new Customer('customer 2');
$sut = new CustomerDeleteEvent($entity, $replacement);
self::assertSame($entity, $sut->getCustomer());
self::assertSame($replacement, $sut->getReplacementCustomer());
}
}

View File

@@ -0,0 +1,37 @@
<?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\Project;
use App\Event\AbstractProjectEvent;
use App\Event\ProjectDeleteEvent;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(ProjectDeleteEvent::class)]
class ProjectDeleteEventTest extends AbstractProjectEventTestCase
{
protected function createProjectEvent(Project $project): AbstractProjectEvent
{
return new ProjectDeleteEvent($project);
}
public function testReplacement(): void
{
$entity = new Project();
$entity->setName('project 1');
$replacement = new Project();
$replacement->setName('project 2');
$sut = new ProjectDeleteEvent($entity, $replacement);
self::assertSame($entity, $sut->getProject());
self::assertSame($replacement, $sut->getReplacementProject());
}
}

View File

@@ -81,4 +81,27 @@ class UtilTest extends TestCase
self::assertEqualsWithDelta(1147.51 * $repeat, $total, 0.00001);
self::assertEqualsWithDelta(149176.3, $total, 0.00001);
}
public function testDecimalDuration(): void
{
$inputs = [
[900, 900],
[1600, 1584],
[4200, 4212],
[8763, 8748],
[3300, 3312],
[600, 612],
[1300, 1296],
[1837, 1836],
[4217, 4212],
[5400, 5400],
[3283, 3276],
[600, 612],
[7200, 7200],
];
foreach ($inputs as $row) {
self::assertEquals($row[1], Util::decimalizeDuration($row[0]));
}
}
}

View File

@@ -911,16 +911,6 @@ parameters:
count: 2
path: Controller/TeamControllerTest.php
-
message: "#^Cannot call method modify\\(\\) on DateTime\\|null\\.$#"
count: 1
path: Controller/TimesheetControllerTest.php
-
message: "#^Cannot call method setTime\\(\\) on DateTime\\|null\\.$#"
count: 1
path: Controller/TimesheetControllerTest.php
-
message: "#^Cannot clone DateTime\\|null\\.$#"
count: 2
@@ -956,11 +946,6 @@ parameters:
count: 1
path: Controller/TimesheetControllerTest.php
-
message: "#^Parameter \\#1 \\$begin of method App\\\\Entity\\\\Timesheet\\:\\:setBegin\\(\\) expects DateTime, DateTime\\|null given\\.$#"
count: 1
path: Controller/TimesheetControllerTest.php
-
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
count: 1
@@ -971,26 +956,11 @@ parameters:
count: 3
path: Controller/TimesheetTeamControllerTest.php
-
message: "#^Cannot call method modify\\(\\) on DateTime\\|null\\.$#"
count: 1
path: Controller/TimesheetTeamControllerTest.php
-
message: "#^Cannot call method setTime\\(\\) on DateTime\\|null\\.$#"
count: 1
path: Controller/TimesheetTeamControllerTest.php
-
message: "#^Cannot clone DateTime\\|null\\.$#"
count: 2
path: Controller/TimesheetTeamControllerTest.php
-
message: "#^Parameter \\#1 \\$begin of method App\\\\Entity\\\\Timesheet\\:\\:setBegin\\(\\) expects DateTime, DateTime\\|null given\\.$#"
count: 1
path: Controller/TimesheetTeamControllerTest.php
-
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
count: 1