random improvements (#5382)
* remove permission check, as own timesheets should always be visible * new methods to create datetime * allow access to user roles in javascript * support class for dropdown actions * allow to edit internal rate * support human readable duration in export via user configuration * allow to order timesheet listing by user, exported and billable field * bump codecov action
This commit is contained in:
@@ -102,7 +102,8 @@ class CsvRendererTest extends AbstractRendererTestCase
|
||||
'2019-06-16',
|
||||
'12:00',
|
||||
'12:06',
|
||||
'0.11',
|
||||
'0:06',
|
||||
//'0.11',
|
||||
'EUR',
|
||||
'0',
|
||||
'0',
|
||||
@@ -134,7 +135,8 @@ class CsvRendererTest extends AbstractRendererTestCase
|
||||
'2019-06-16',
|
||||
'12:00',
|
||||
'12:06',
|
||||
'0.11',
|
||||
'0:06',
|
||||
//'0.11',
|
||||
'EUR',
|
||||
'0',
|
||||
'0',
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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\Export\Package\CellFormatter;
|
||||
|
||||
use App\Export\Package\CellFormatter\DurationDecimalFormatter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Export\Package\CellFormatter\DurationDecimalFormatter
|
||||
*/
|
||||
class DurationDecimalFormatterTest extends TestCase
|
||||
{
|
||||
public function testFormatValueReturnsFormattedDurationForNumericValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue(7200);
|
||||
self::assertEquals(2.00, $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsZeroForNonNumericValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue('not a number');
|
||||
self::assertEquals(0.0, $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsFormattedDurationForFloatValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue(4500.5);
|
||||
self::assertEquals(1.25, $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsFormattedDurationForStringValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue('4500.5');
|
||||
self::assertEquals(1.25, $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsZeroForNullValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue(null);
|
||||
self::assertEquals(0.0, $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsFormattedDurationForNegativeValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue(-3600);
|
||||
self::assertEquals(-1.00, $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsFormattedDurationForNegativeStringValue(): void
|
||||
{
|
||||
$formatter = new DurationDecimalFormatter();
|
||||
$result = $formatter->formatValue('-3600');
|
||||
self::assertEquals(-1.00, $result);
|
||||
}
|
||||
}
|
||||
@@ -21,34 +21,34 @@ class DurationFormatterTest extends TestCase
|
||||
{
|
||||
$formatter = new DurationFormatter();
|
||||
$result = $formatter->formatValue(7200);
|
||||
self::assertEquals(2.00, $result);
|
||||
self::assertEquals('2:00', $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsZeroForNonNumericValue(): void
|
||||
{
|
||||
$formatter = new DurationFormatter();
|
||||
$result = $formatter->formatValue('not a number');
|
||||
self::assertEquals(0.0, $result);
|
||||
self::assertEquals('0:00', $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsFormattedDurationForFloatValue(): void
|
||||
{
|
||||
$formatter = new DurationFormatter();
|
||||
$result = $formatter->formatValue(4500.5);
|
||||
self::assertEquals(1.25, $result);
|
||||
self::assertEquals('1:15', $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsZeroForNullValue(): void
|
||||
{
|
||||
$formatter = new DurationFormatter();
|
||||
$result = $formatter->formatValue(null);
|
||||
self::assertEquals(0.0, $result);
|
||||
self::assertEquals('0:00', $result);
|
||||
}
|
||||
|
||||
public function testFormatValueReturnsFormattedDurationForNegativeValue(): void
|
||||
{
|
||||
$formatter = new DurationFormatter();
|
||||
$result = $formatter->formatValue(-3600);
|
||||
self::assertEquals(-1.00, $result);
|
||||
self::assertEquals('-1:00', $result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,6 +459,7 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
'name' => null,
|
||||
'admin' => false,
|
||||
'superAdmin' => false,
|
||||
'roles' => [],
|
||||
],
|
||||
];
|
||||
$user = $this->createMock(User::class);
|
||||
@@ -488,6 +489,7 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
'name' => 'anonymous',
|
||||
'admin' => false,
|
||||
'superAdmin' => false,
|
||||
'roles' => [],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user