use events for budget calculation (#2544)

This commit is contained in:
Kevin Papst
2021-04-29 11:50:48 +02:00
committed by GitHub
parent bb94b11e37
commit e4b176a4d5
30 changed files with 384 additions and 92 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\AbstractActivityEvent;
use App\Event\ActivityStatisticEvent;
use App\Model\ActivityStatistic;
/**
* @covers \App\Event\AbstractActivityEvent
* @covers \App\Event\ActivityStatisticEvent
*/
class ActivityStatisticEventTest extends AbstractActivityEventTest
{
protected function createActivityEvent(Activity $activity): AbstractActivityEvent
{
return new ActivityStatisticEvent($activity, new ActivityStatistic());
}
public function testStatistic()
{
$activity = new Activity();
$statistic = new ActivityStatistic();
$sut = new ActivityStatisticEvent($activity, $statistic);
self::assertSame($statistic, $sut->getStatistic());
}
}

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\Customer;
use App\Event\AbstractCustomerEvent;
use App\Event\CustomerStatisticEvent;
use App\Model\CustomerStatistic;
/**
* @covers \App\Event\AbstractCustomerEvent
* @covers \App\Event\CustomerStatisticEvent
*/
class CustomerStatisticEventTest extends AbstractCustomerEventTest
{
protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent
{
return new CustomerStatisticEvent($customer, new CustomerStatistic());
}
public function testStatistic()
{
$customer = new Customer();
$statistic = new CustomerStatistic();
$sut = new CustomerStatisticEvent($customer, $statistic);
self::assertSame($statistic, $sut->getStatistic());
}
}

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\Project;
use App\Event\AbstractProjectEvent;
use App\Event\ProjectStatisticEvent;
use App\Model\ProjectStatistic;
/**
* @covers \App\Event\AbstractProjectEvent
* @covers \App\Event\ProjectStatisticEvent
*/
class ProjectStatisticEventTest extends AbstractProjectEventTest
{
protected function createProjectEvent(Project $project): AbstractProjectEvent
{
return new ProjectStatisticEvent($project, new ProjectStatistic());
}
public function testStatistic()
{
$project = new Project();
$statistic = new ProjectStatistic();
$sut = new ProjectStatisticEvent($project, $statistic);
self::assertSame($statistic, $sut->getStatistic());
}
}