Files
kimai2/tests/Mocks/RateServiceFactory.php
Kevin Papst 595b5f4b25 Configurable rate rounding (#5734)
* added invoice hydration of the issuer object
* added "rate calculator" mode
* new config to select rounding mode
* replace static calls with dependency injection
2025-12-16 16:47:46 +01:00

28 lines
787 B
PHP

<?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\Mocks;
use App\Repository\TimesheetRepository;
use App\Timesheet\RateCalculator\ClassicRateCalculator;
use App\Timesheet\RateService;
class RateServiceFactory extends AbstractMockFactory
{
public function create(array $rules = [], array $rates = []): RateService
{
$mock = $this->createMock(TimesheetRepository::class);
if (!empty($rates)) {
$mock->expects($this->getTestCase()->any())->method('findMatchingRates')->willReturn($rates);
}
return new RateService($rules, $mock, new ClassicRateCalculator());
}
}