invoices: choose language and duration format (#1438)

This commit is contained in:
Kevin Papst
2020-02-04 20:27:36 +01:00
committed by GitHub
parent 75dcae6fbe
commit 986d922855
64 changed files with 1559 additions and 541 deletions

View File

@@ -0,0 +1,58 @@
<?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\Invoice\Hydrator;
use App\Invoice\Hydrator\InvoiceModelActivityHydrator;
use App\Tests\Invoice\Renderer\RendererTestTrait;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Invoice\Hydrator\InvoiceModelActivityHydrator
*/
class InvoiceModelActivityHydratorTest extends TestCase
{
use RendererTestTrait;
public function testHydrate()
{
$model = $this->getInvoiceModel();
$sut = new InvoiceModelActivityHydrator();
$result = $sut->hydrate($model);
$this->assertModelStructure($result);
$model->getQuery()->setActivity(null);
$result = $sut->hydrate($model);
self::assertEmpty($result);
}
protected function assertModelStructure(array $model)
{
$keys = [
'activity.id',
'activity.name',
'activity.comment',
'activity.fixed_rate',
'activity.fixed_rate_nc',
'activity.fixed_rate_plain',
'activity.hourly_rate',
'activity.hourly_rate_nc',
'activity.hourly_rate_plain',
'activity.meta.foo-activity',
];
$givenKeys = array_keys($model);
sort($keys);
sort($givenKeys);
$this->assertEquals($keys, $givenKeys);
}
}