mirror of
https://github.com/kevinpapst/kimai2.git
synced 2025-04-30 15:30:11 +00:00

- show "link has expired message" in password reset screen - added date objects as hydrator variables - for custom date formats in invoice templates - show meta-fields with null values (e.g. booleans with `false` where hidden) - fix permission check: allow to remove `view_own_timesheet` but still record times - prevent error 500 if customer country is empty - fix API 500 error if project does not exist when creating new timesheet - fix tags are not created in remote-search mode - do not check "export items" by default - fix daterange query, if user an request locale are different - added logging for invalid SAML responses (see various discussions)
95 lines
2.6 KiB
PHP
95 lines
2.6 KiB
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\Invoice\Hydrator;
|
|
|
|
use App\Invoice\Hydrator\InvoiceModelDefaultHydrator;
|
|
use App\Tests\Invoice\Renderer\RendererTestTrait;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* @covers \App\Invoice\Hydrator\InvoiceModelDefaultHydrator
|
|
*/
|
|
class InvoiceModelDefaultHydratorTest extends TestCase
|
|
{
|
|
use RendererTestTrait;
|
|
|
|
public function testHydrate(): void
|
|
{
|
|
$model = $this->getInvoiceModel();
|
|
|
|
$sut = new InvoiceModelDefaultHydrator();
|
|
|
|
$result = $sut->hydrate($model);
|
|
$this->assertModelStructure($result);
|
|
}
|
|
|
|
protected function assertModelStructure(array $model, bool $hasProject = true): void
|
|
{
|
|
$keys = [
|
|
'invoice.due_date',
|
|
'invoice.due_date_process',
|
|
'invoice.date',
|
|
'invoice.date_process',
|
|
'invoice.number',
|
|
'invoice.currency',
|
|
'invoice.currency_symbol',
|
|
'invoice.vat',
|
|
'invoice.language',
|
|
'invoice.tax',
|
|
'invoice.tax_hide',
|
|
'invoice.tax_nc',
|
|
'invoice.tax_plain',
|
|
'invoice.total_time',
|
|
'invoice.duration_decimal',
|
|
'invoice.first',
|
|
'invoice.first_process',
|
|
'invoice.last',
|
|
'invoice.last_process',
|
|
'invoice.total',
|
|
'invoice.total_nc',
|
|
'invoice.total_plain',
|
|
'invoice.subtotal',
|
|
'invoice.subtotal_nc',
|
|
'invoice.subtotal_plain',
|
|
'template.name',
|
|
'template.company',
|
|
'template.address',
|
|
'template.title',
|
|
'template.payment_terms',
|
|
'template.due_days',
|
|
'template.vat_id',
|
|
'template.contact',
|
|
'template.payment_details',
|
|
'query.day',
|
|
'query.month',
|
|
'query.month_number',
|
|
'query.year',
|
|
'query.begin',
|
|
'query.begin_process',
|
|
'query.begin_day',
|
|
'query.begin_month',
|
|
'query.begin_month_number',
|
|
'query.begin_year',
|
|
'query.end',
|
|
'query.end_process',
|
|
'query.end_day',
|
|
'query.end_month',
|
|
'query.end_month_number',
|
|
'query.end_year',
|
|
'user.see_others',
|
|
];
|
|
|
|
$givenKeys = array_keys($model);
|
|
sort($keys);
|
|
sort($givenKeys);
|
|
|
|
$this->assertEquals($keys, $givenKeys);
|
|
}
|
|
}
|