Release 2.41 (#5653)

This commit is contained in:
Kevin Papst
2025-11-08 23:03:44 +01:00
committed by GitHub
parent 636a51e721
commit 1a38c7d7a3
57 changed files with 705 additions and 409 deletions

View File

@@ -68,13 +68,16 @@ class PriceInvoiceCalculatorTest extends AbstractCalculatorTestCase
$timesheet2 = new Timesheet();
$timesheet2->setBegin(new DateTime('2018-11-29'));
$timesheet2->setEnd(new DateTime());
$timesheet2->setDuration(400);
$timesheet2->setDuration(400); // 396
$timesheet2->setHourlyRate(293.27);
$timesheet2->setRate(84.75);
$timesheet2->setRate(84.75); // 32,26
$timesheet2->setUser($user);
$timesheet2->setActivity((new Activity())->setName('bar'));
$timesheet2->setProject($project2);
// 325,53
// duration 4000 = 3996
$timesheet3 = new Timesheet();
$timesheet3->setBegin(new DateTime('2018-11-28'));
$timesheet3->setEnd(new DateTime());
@@ -85,25 +88,34 @@ class PriceInvoiceCalculatorTest extends AbstractCalculatorTestCase
$timesheet3->setActivity((new Activity())->setName('foo'));
$timesheet3->setProject($project1);
// 325,53+111,11
// duration 1800
$timesheet4 = new Timesheet();
$timesheet4->setBegin(new DateTime('2018-11-28'));
$timesheet4->setEnd(new DateTime());
$timesheet4->setDuration(400);
$timesheet4->setDuration(400); // 396
$timesheet4->setHourlyRate(0);
$timesheet4->setRate(1947.99);
$timesheet4->setUser($user);
$timesheet4->setActivity((new Activity())->setName('blub'));
$timesheet4->setProject($project2);
// 325,53+111,11+1947,99
// duration 400
$timesheet5 = new Timesheet();
$timesheet5->setBegin(new DateTime('2018-11-28'));
$timesheet5->setEnd(new DateTime());
$timesheet5->setDuration(400);
$timesheet5->setDuration(400); // 396
$timesheet5->setRate(84);
$timesheet5->setUser(new User());
$timesheet5->setActivity(new Activity());
$timesheet5->setProject($project3);
// 325,53+111,11+1947,99+84
// duration 400
$entries = [$timesheet, $timesheet2, $timesheet3, $timesheet4, $timesheet5];
$query = new InvoiceQuery();
@@ -115,12 +127,14 @@ class PriceInvoiceCalculatorTest extends AbstractCalculatorTestCase
$sut = $this->getCalculator();
$sut->setModel($model);
// (325,53+111,11+1947,99+84)*1,19
self::assertEquals('price', $sut->getId());
self::assertEquals(3000.13, $sut->getTotal());
self::assertEquals(2937.67, $sut->getTotal());
$this->assertTax($sut, 19);
self::assertEquals('EUR', $model->getCurrency());
self::assertEquals(2521.12, $sut->getSubtotal());
self::assertEquals(6600, $sut->getTimeWorked());
self::assertEquals(2468.63, $sut->getSubtotal());
self::assertEquals(6596, $sut->getTimeWorked());
$entries = $sut->getEntries();
self::assertCount(4, $entries);
@@ -130,7 +144,7 @@ class PriceInvoiceCalculatorTest extends AbstractCalculatorTestCase
self::assertEquals('2018-11-28', $entries[2]->getBegin()?->format('Y-m-d'));
self::assertEquals('2018-11-29', $entries[3]->getBegin()?->format('Y-m-d'));
self::assertEquals(378.02, $entries[3]->getRate());
self::assertEquals(325.53, $entries[3]->getRate());
self::assertEquals(111.11, $entries[0]->getRate());
self::assertEquals(1947.99, $entries[1]->getRate());
self::assertEquals(84, $entries[2]->getRate());