added events for timesheet actions (#1598)
This commit is contained in:
@@ -478,7 +478,7 @@ class TimesheetController extends BaseApiController
|
|||||||
throw $this->createAccessDeniedException('You are not allowed to delete this timesheet');
|
throw $this->createAccessDeniedException('You are not allowed to delete this timesheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->repository->delete($timesheet);
|
$this->service->deleteTimesheet($timesheet);
|
||||||
|
|
||||||
$view = new View(null, Response::HTTP_NO_CONTENT);
|
$view = new View(null, Response::HTTP_NO_CONTENT);
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
|||||||
|
|
||||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||||
try {
|
try {
|
||||||
$this->repository->save($entry);
|
$this->service->updateTimesheet($entry);
|
||||||
$this->flashSuccess('action.update.success');
|
$this->flashSuccess('action.update.success');
|
||||||
|
|
||||||
return $this->redirectToRoute($this->getTimesheetRoute(), ['page' => $request->get('page', 1)]);
|
return $this->redirectToRoute($this->getTimesheetRoute(), ['page' => $request->get('page', 1)]);
|
||||||
@@ -344,7 +344,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
|||||||
|
|
||||||
if ($execute) {
|
if ($execute) {
|
||||||
try {
|
try {
|
||||||
$this->repository->saveMultiple($dto->getEntities());
|
$this->service->updateMultipleTimesheets($dto->getEntities());
|
||||||
$this->flashSuccess('action.update.success');
|
$this->flashSuccess('action.update.success');
|
||||||
|
|
||||||
return $this->redirectToRoute($this->getTimesheetRoute());
|
return $this->redirectToRoute($this->getTimesheetRoute());
|
||||||
@@ -378,7 +378,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
|||||||
$dto->setEntities($timesheets);
|
$dto->setEntities($timesheets);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->repository->deleteMultiple($dto->getEntities());
|
$this->service->deleteMultipleTimesheets($dto->getEntities());
|
||||||
$this->flashSuccess('action.delete.success');
|
$this->flashSuccess('action.delete.success');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||||
|
|||||||
34
src/Event/AbstractTimesheetEvent.php
Normal file
34
src/Event/AbstractTimesheetEvent.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\Event;
|
||||||
|
|
||||||
|
use App\Entity\Timesheet;
|
||||||
|
use Symfony\Contracts\EventDispatcher\Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base event class to used with timesheet manipulations.
|
||||||
|
*/
|
||||||
|
abstract class AbstractTimesheetEvent extends Event
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Timesheet
|
||||||
|
*/
|
||||||
|
private $timesheet;
|
||||||
|
|
||||||
|
public function __construct(Timesheet $timesheet)
|
||||||
|
{
|
||||||
|
$this->timesheet = $timesheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTimesheet(): Timesheet
|
||||||
|
{
|
||||||
|
return $this->timesheet;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/Event/AbstractTimesheetMultipleEvent.php
Normal file
34
src/Event/AbstractTimesheetMultipleEvent.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\Event;
|
||||||
|
|
||||||
|
use App\Entity\Timesheet;
|
||||||
|
use Symfony\Contracts\EventDispatcher\Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base event class to used with timesheet manipulations.
|
||||||
|
*/
|
||||||
|
abstract class AbstractTimesheetMultipleEvent extends Event
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Timesheet[]
|
||||||
|
*/
|
||||||
|
private $timesheets;
|
||||||
|
|
||||||
|
public function __construct(array $timesheets)
|
||||||
|
{
|
||||||
|
$this->timesheets = $timesheets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTimesheets(): array
|
||||||
|
{
|
||||||
|
return $this->timesheets;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/Event/TimesheetCreatePostEvent.php
Normal file
14
src/Event/TimesheetCreatePostEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetCreatePostEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetCreatePreEvent.php
Normal file
14
src/Event/TimesheetCreatePreEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetCreatePreEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetDeleteMultiplePreEvent.php
Normal file
14
src/Event/TimesheetDeleteMultiplePreEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetDeleteMultiplePreEvent extends AbstractTimesheetMultipleEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetDeletePreEvent.php
Normal file
14
src/Event/TimesheetDeletePreEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetDeletePreEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetStopPostEvent.php
Normal file
14
src/Event/TimesheetStopPostEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetStopPostEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetStopPreEvent.php
Normal file
14
src/Event/TimesheetStopPreEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetStopPreEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetUpdateMultiplePostEvent.php
Normal file
14
src/Event/TimesheetUpdateMultiplePostEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetUpdateMultiplePostEvent extends AbstractTimesheetMultipleEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetUpdateMultiplePreEvent.php
Normal file
14
src/Event/TimesheetUpdateMultiplePreEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetUpdateMultiplePreEvent extends AbstractTimesheetMultipleEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetUpdatePostEvent.php
Normal file
14
src/Event/TimesheetUpdatePostEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetUpdatePostEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
14
src/Event/TimesheetUpdatePreEvent.php
Normal file
14
src/Event/TimesheetUpdatePreEvent.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?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\Event;
|
||||||
|
|
||||||
|
final class TimesheetUpdatePreEvent extends AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -12,7 +12,17 @@ namespace App\Timesheet;
|
|||||||
use App\Configuration\TimesheetConfiguration;
|
use App\Configuration\TimesheetConfiguration;
|
||||||
use App\Entity\Timesheet;
|
use App\Entity\Timesheet;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
|
use App\Event\TimesheetCreatePostEvent;
|
||||||
|
use App\Event\TimesheetCreatePreEvent;
|
||||||
|
use App\Event\TimesheetDeleteMultiplePreEvent;
|
||||||
|
use App\Event\TimesheetDeletePreEvent;
|
||||||
use App\Event\TimesheetMetaDefinitionEvent;
|
use App\Event\TimesheetMetaDefinitionEvent;
|
||||||
|
use App\Event\TimesheetStopPostEvent;
|
||||||
|
use App\Event\TimesheetStopPreEvent;
|
||||||
|
use App\Event\TimesheetUpdateMultiplePostEvent;
|
||||||
|
use App\Event\TimesheetUpdateMultiplePreEvent;
|
||||||
|
use App\Event\TimesheetUpdatePostEvent;
|
||||||
|
use App\Event\TimesheetUpdatePreEvent;
|
||||||
use App\Repository\TimesheetRepository;
|
use App\Repository\TimesheetRepository;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@@ -75,7 +85,7 @@ final class TimesheetService
|
|||||||
return $timesheet;
|
return $timesheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepareNewTimesheet(Timesheet $timesheet, ?Request $request = null)
|
public function prepareNewTimesheet(Timesheet $timesheet, ?Request $request = null): Timesheet
|
||||||
{
|
{
|
||||||
if (null !== $timesheet->getId()) {
|
if (null !== $timesheet->getId()) {
|
||||||
throw new \InvalidArgumentException('Cannot prepare timesheet, already persisted');
|
throw new \InvalidArgumentException('Cannot prepare timesheet, already persisted');
|
||||||
@@ -90,7 +100,7 @@ final class TimesheetService
|
|||||||
return $timesheet;
|
return $timesheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveNewTimesheet(Timesheet $timesheet)
|
public function saveNewTimesheet(Timesheet $timesheet): Timesheet
|
||||||
{
|
{
|
||||||
if (null !== $timesheet->getId()) {
|
if (null !== $timesheet->getId()) {
|
||||||
throw new \InvalidArgumentException('Cannot create timesheet, already persisted');
|
throw new \InvalidArgumentException('Cannot create timesheet, already persisted');
|
||||||
@@ -100,18 +110,47 @@ final class TimesheetService
|
|||||||
throw new AccessDeniedHttpException('You are not allowed to start this timesheet record');
|
throw new AccessDeniedHttpException('You are not allowed to start this timesheet record');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->dispatcher->dispatch(new TimesheetCreatePreEvent($timesheet));
|
||||||
$this->repository->add($timesheet, $this->configuration->getActiveEntriesHardLimit());
|
$this->repository->add($timesheet, $this->configuration->getActiveEntriesHardLimit());
|
||||||
|
$this->dispatcher->dispatch(new TimesheetCreatePostEvent($timesheet));
|
||||||
|
|
||||||
return $timesheet;
|
return $timesheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateTimesheet(Timesheet $timesheet)
|
public function updateTimesheet(Timesheet $timesheet): Timesheet
|
||||||
{
|
{
|
||||||
return $this->repository->save($timesheet);
|
$this->dispatcher->dispatch(new TimesheetUpdatePreEvent($timesheet));
|
||||||
|
$this->repository->save($timesheet);
|
||||||
|
$this->dispatcher->dispatch(new TimesheetUpdatePostEvent($timesheet));
|
||||||
|
|
||||||
|
return $timesheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stopTimesheet(Timesheet $timesheet)
|
public function updateMultipleTimesheets(array $timesheets): array
|
||||||
{
|
{
|
||||||
return $this->repository->stopRecording($timesheet);
|
$this->dispatcher->dispatch(new TimesheetUpdateMultiplePreEvent($timesheets));
|
||||||
|
$this->repository->saveMultiple($timesheets);
|
||||||
|
$this->dispatcher->dispatch(new TimesheetUpdateMultiplePostEvent($timesheets));
|
||||||
|
|
||||||
|
return $timesheets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stopTimesheet(Timesheet $timesheet): void
|
||||||
|
{
|
||||||
|
$this->dispatcher->dispatch(new TimesheetStopPreEvent($timesheet));
|
||||||
|
$this->repository->stopRecording($timesheet);
|
||||||
|
$this->dispatcher->dispatch(new TimesheetStopPostEvent($timesheet));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteTimesheet(Timesheet $timesheet): void
|
||||||
|
{
|
||||||
|
$this->dispatcher->dispatch(new TimesheetDeletePreEvent($timesheet));
|
||||||
|
$this->repository->delete($timesheet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteMultipleTimesheets(array $timesheets): void
|
||||||
|
{
|
||||||
|
$this->dispatcher->dispatch(new TimesheetDeleteMultiplePreEvent($timesheets));
|
||||||
|
$this->repository->deleteMultiple($timesheets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
tests/Event/AbstractTimesheetEventTest.php
Normal file
29
tests/Event/AbstractTimesheetEventTest.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Contracts\EventDispatcher\Event;
|
||||||
|
|
||||||
|
abstract class AbstractTimesheetEventTest extends TestCase
|
||||||
|
{
|
||||||
|
abstract protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent;
|
||||||
|
|
||||||
|
public function testGetterAndSetter()
|
||||||
|
{
|
||||||
|
$timesheet = new Timesheet();
|
||||||
|
$sut = $this->createTimesheetEvent($timesheet);
|
||||||
|
|
||||||
|
self::assertInstanceOf(Event::class, $sut);
|
||||||
|
self::assertSame($timesheet, $sut->getTimesheet());
|
||||||
|
}
|
||||||
|
}
|
||||||
29
tests/Event/AbstractTimesheetMultipleEventTest.php
Normal file
29
tests/Event/AbstractTimesheetMultipleEventTest.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetMultipleEvent;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Contracts\EventDispatcher\Event;
|
||||||
|
|
||||||
|
abstract class AbstractTimesheetMultipleEventTest extends TestCase
|
||||||
|
{
|
||||||
|
abstract protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent;
|
||||||
|
|
||||||
|
public function testGetterAndSetter()
|
||||||
|
{
|
||||||
|
$timesheets = [new Timesheet(), new Timesheet()];
|
||||||
|
$sut = $this->createTimesheetMultipleEvent($timesheets);
|
||||||
|
|
||||||
|
self::assertInstanceOf(Event::class, $sut);
|
||||||
|
self::assertSame($timesheets, $sut->getTimesheets());
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetCreatePostEventTest.php
Normal file
26
tests/Event/TimesheetCreatePostEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetCreatePostEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetCreatePostEvent
|
||||||
|
*/
|
||||||
|
class TimesheetCreatePostEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetCreatePostEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetCreatePreEventTest.php
Normal file
26
tests/Event/TimesheetCreatePreEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetCreatePreEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetCreatePreEvent
|
||||||
|
*/
|
||||||
|
class TimesheetCreatePreEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetCreatePreEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
tests/Event/TimesheetDeleteMultiplePreEventTest.php
Normal file
25
tests/Event/TimesheetDeleteMultiplePreEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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\Event\AbstractTimesheetMultipleEvent;
|
||||||
|
use App\Event\TimesheetDeleteMultiplePreEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetMultipleEvent
|
||||||
|
* @covers \App\Event\TimesheetDeleteMultiplePreEvent
|
||||||
|
*/
|
||||||
|
class TimesheetDeleteMultiplePreEventTest extends AbstractTimesheetMultipleEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent
|
||||||
|
{
|
||||||
|
return new TimesheetDeleteMultiplePreEvent($timesheets);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetDeletePreEventTest.php
Normal file
26
tests/Event/TimesheetDeletePreEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetDeletePreEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetDeletePreEvent
|
||||||
|
*/
|
||||||
|
class TimesheetDeletePreEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetDeletePreEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetStopPostEventTest.php
Normal file
26
tests/Event/TimesheetStopPostEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetStopPostEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetStopPostEvent
|
||||||
|
*/
|
||||||
|
class TimesheetStopPostEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetStopPostEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetStopPreEventTest.php
Normal file
26
tests/Event/TimesheetStopPreEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetStopPreEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetStopPreEvent
|
||||||
|
*/
|
||||||
|
class TimesheetStopPreEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetStopPreEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
tests/Event/TimesheetUpdateMultiplePostEventTest.php
Normal file
25
tests/Event/TimesheetUpdateMultiplePostEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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\Event\AbstractTimesheetMultipleEvent;
|
||||||
|
use App\Event\TimesheetUpdateMultiplePostEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetMultipleEvent
|
||||||
|
* @covers \App\Event\TimesheetUpdateMultiplePostEvent
|
||||||
|
*/
|
||||||
|
class TimesheetUpdateMultiplePostEventTest extends AbstractTimesheetMultipleEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent
|
||||||
|
{
|
||||||
|
return new TimesheetUpdateMultiplePostEvent($timesheets);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
tests/Event/TimesheetUpdateMultiplePreEventTest.php
Normal file
25
tests/Event/TimesheetUpdateMultiplePreEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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\Event\AbstractTimesheetMultipleEvent;
|
||||||
|
use App\Event\TimesheetUpdateMultiplePreEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetMultipleEvent
|
||||||
|
* @covers \App\Event\TimesheetUpdateMultiplePreEvent
|
||||||
|
*/
|
||||||
|
class TimesheetUpdateMultiplePreEventTest extends AbstractTimesheetMultipleEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent
|
||||||
|
{
|
||||||
|
return new TimesheetUpdateMultiplePreEvent($timesheets);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetUpdatePostEventTest.php
Normal file
26
tests/Event/TimesheetUpdatePostEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetUpdatePostEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetUpdatePostEvent
|
||||||
|
*/
|
||||||
|
class TimesheetUpdatePostEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetUpdatePostEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tests/Event/TimesheetUpdatePreEventTest.php
Normal file
26
tests/Event/TimesheetUpdatePreEventTest.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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\Timesheet;
|
||||||
|
use App\Event\AbstractTimesheetEvent;
|
||||||
|
use App\Event\TimesheetUpdatePreEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \App\Event\AbstractTimesheetEvent
|
||||||
|
* @covers \App\Event\TimesheetUpdatePreEvent
|
||||||
|
*/
|
||||||
|
class TimesheetUpdatePreEventTest extends AbstractTimesheetEventTest
|
||||||
|
{
|
||||||
|
protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent
|
||||||
|
{
|
||||||
|
return new TimesheetUpdatePreEvent($timesheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user