added events for timesheet actions (#1598)
This commit is contained in:
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