Release 2.42 (#5686)
This commit is contained in:
36
tests/Event/ActivityDeleteEventTest.php
Normal file
36
tests/Event/ActivityDeleteEventTest.php
Normal 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());
|
||||
}
|
||||
}
|
||||
35
tests/Event/CustomerDeleteEventTest.php
Normal file
35
tests/Event/CustomerDeleteEventTest.php
Normal 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());
|
||||
}
|
||||
}
|
||||
37
tests/Event/ProjectDeleteEventTest.php
Normal file
37
tests/Event/ProjectDeleteEventTest.php
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user