Release 2.12 (#4609)

This commit is contained in:
Kevin Papst
2024-02-07 23:47:25 +01:00
committed by GitHub
parent 7abe787778
commit 85a16a9363
394 changed files with 1189 additions and 6735 deletions

View File

@@ -59,7 +59,7 @@ class ContextTest extends TestCase
];
}
public function testIsModalRequest()
public function testIsModalRequest(): void
{
$sut = $this->getSut($this->getDefaultSettings());
self::assertFalse($sut->isModalRequest());
@@ -71,7 +71,7 @@ class ContextTest extends TestCase
self::assertTrue($sut->isModalRequest());
}
public function testIsJavascriptRequest()
public function testIsJavascriptRequest(): void
{
$sut = $this->getSut($this->getDefaultSettings());
self::assertFalse($sut->isJavascriptRequest());

View File

@@ -27,7 +27,7 @@ class DatatableExtensionsTest extends TestCase
return new DatatableExtensions($repository, new ProfileManager());
}
public function testGetFunctions()
public function testGetFunctions(): void
{
$functions = ['initialize_datatable', 'datatable_column_class'];
$sut = $this->getSut('de');

View File

@@ -41,7 +41,7 @@ class ExtensionsTest extends TestCase
throw new \Exception('Unknown twig test: ' . $name);
}
public function testGetFilters()
public function testGetFilters(): void
{
$filters = ['report_date', 'docu_link', 'multiline_indent', 'color', 'font_contrast', 'default_color', 'nl2str'];
$sut = $this->getSut();
@@ -62,7 +62,7 @@ class ExtensionsTest extends TestCase
self::assertEquals(['html'], $twigFilters[$id]->getSafe(new Node()));
}
public function testGetFunctions()
public function testGetFunctions(): void
{
$functions = ['class_name', 'iso_day_by_name', 'random_color'];
$sut = $this->getSut();
@@ -76,7 +76,7 @@ class ExtensionsTest extends TestCase
}
}
public function testGetTests()
public function testGetTests(): void
{
$tests = ['number'];
$i = 0;
@@ -92,7 +92,7 @@ class ExtensionsTest extends TestCase
}
}
public function testDocuLink()
public function testDocuLink(): void
{
$data = [
'timesheet.html' => 'https://www.kimai.org/documentation/timesheet.html',
@@ -108,7 +108,7 @@ class ExtensionsTest extends TestCase
}
}
public function testGetClassName()
public function testGetClassName(): void
{
$sut = $this->getSut();
$this->assertEquals('DateTime', $sut->getClassName(new \DateTime()));
@@ -152,7 +152,7 @@ sdfsdf' . PHP_EOL . "\n" .
/**
* @dataProvider getMultilineTestData
*/
public function testMultilineIndent($indent, $string, $expected)
public function testMultilineIndent($indent, $string, $expected): void
{
$sut = $this->getSut();
self::assertEquals(implode("\n", $expected), $sut->multilineIndent($string, $indent));
@@ -161,7 +161,7 @@ sdfsdf' . PHP_EOL . "\n" .
/**
* Just a very short test, as this delegates to Utils/Color
*/
public function testColor()
public function testColor(): void
{
$sut = $this->getSut();
@@ -177,14 +177,14 @@ sdfsdf' . PHP_EOL . "\n" .
/**
* Just a very short test, as this delegates to Utils/Color
*/
public function testFontContrast()
public function testFontContrast(): void
{
$sut = $this->getSut();
self::assertEquals('#000000', $sut->calculateFontContrastColor('#ccc'));
}
public function testIsoDayByName()
public function testIsoDayByName(): void
{
$sut = $this->getSut();
@@ -214,14 +214,14 @@ sdfsdf' . PHP_EOL . "\n" .
/**
* @dataProvider getTestDataReplaceNewline
*/
public function testReplaceNewline(string $replacer, $input, $expected)
public function testReplaceNewline(string $replacer, $input, $expected): void
{
$sut = $this->getSut();
self::assertEquals($expected, $sut->replaceNewline($input, $replacer));
}
public function testGetRandomColor()
public function testGetRandomColor(): void
{
$sut = $this->getSut();
@@ -232,7 +232,7 @@ sdfsdf' . PHP_EOL . "\n" .
self::assertEquals($fooColor, $sut->randomColor('foo-bar'));
}
public function testGetDefaultColor()
public function testGetDefaultColor(): void
{
$sut = $this->getSut();
@@ -242,7 +242,7 @@ sdfsdf' . PHP_EOL . "\n" .
self::assertEquals('', $sut->defaultColor(''));
}
public function testIsNumeric()
public function testIsNumeric(): void
{
$test = $this->getTest('number');
self::assertFalse(\call_user_func($test->getCallable(), null));

View File

@@ -45,7 +45,7 @@ class PaginationExtensionTest extends TestCase
return new PaginationExtension($this->getUrlGenerator());
}
public function testGetFunctions()
public function testGetFunctions(): void
{
$functions = ['pagination'];
$sut = $this->getSut();
@@ -59,7 +59,7 @@ class PaginationExtensionTest extends TestCase
}
}
public function testRenderPaginationWithoutTemplateName()
public function testRenderPaginationWithoutTemplateName(): void
{
$sut = $this->getSut();
@@ -73,7 +73,7 @@ class PaginationExtensionTest extends TestCase
$this->assertPaginationHtml($result);
}
protected function assertPaginationHtml($result)
public function assertPaginationHtml($result): void
{
// this makes sure that we show the correct amount of pagination links!
$expected =
@@ -92,7 +92,7 @@ class PaginationExtensionTest extends TestCase
self::assertEquals($expected, $result);
}
public function testRenderPagination()
public function testRenderPagination(): void
{
$sut = $this->getSut();
@@ -106,7 +106,7 @@ class PaginationExtensionTest extends TestCase
$this->assertPaginationHtml($result);
}
public function testRenderPaginationWithoutRouteName()
public function testRenderPaginationWithoutRouteName(): void
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Pagination is missing the "routeName" option');

View File

@@ -31,12 +31,12 @@ class EncoreExtensionTest extends TestCase
return new EncoreExtension($container, __DIR__ . '/../');
}
public function testGetSubscribedServices()
public function testGetSubscribedServices(): void
{
self::assertEquals([EntrypointLookupInterface::class], EncoreExtension::getSubscribedServices());
}
public function testGetEncoreEntryCssSource()
public function testGetEncoreEntryCssSource(): void
{
$sut = $this->getSut(['test.css', 'test1.css']);
$css = 'body { margin: 0; }p

View File

@@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase;
*/
class MarkdownExtensionTest extends TestCase
{
public function testMarkdownToHtml()
public function testMarkdownToHtml(): void
{
$loader = $this->createMock(ConfigLoaderInterface::class);
$config = SystemConfigurationFactory::create($loader, ['timesheet' => ['markdown_content' => true]]);
@@ -33,7 +33,7 @@ class MarkdownExtensionTest extends TestCase
);
}
public function testTimesheetContent()
public function testTimesheetContent(): void
{
$loader = $this->createMock(ConfigLoaderInterface::class);
$config = SystemConfigurationFactory::create($loader, ['timesheet' => ['markdown_content' => false]]);
@@ -60,7 +60,7 @@ class MarkdownExtensionTest extends TestCase
);
}
public function testCommentContent()
public function testCommentContent(): void
{
$loader = $this->createMock(ConfigLoaderInterface::class);
$config = SystemConfigurationFactory::create($loader, ['timesheet' => ['markdown_content' => false]]);
@@ -100,7 +100,7 @@ class MarkdownExtensionTest extends TestCase
);
}
public function testCommentOneLiner()
public function testCommentOneLiner(): void
{
$loader = $this->createMock(ConfigLoaderInterface::class);
$config = SystemConfigurationFactory::create($loader, []);

View File

@@ -87,21 +87,21 @@ class ThemeEventExtensionTest extends TestCase
return $environment;
}
public function testTrigger()
public function testTrigger(): void
{
$sut = $this->getSut();
$event = $sut->trigger($this->getEnvironment(), 'foo', []);
self::assertInstanceOf(ThemeEvent::class, $event);
}
public function testTriggerWithoutListener()
public function testTriggerWithoutListener(): void
{
$sut = $this->getSut(false);
$event = $sut->trigger($this->getEnvironment(), 'foo', []);
self::assertInstanceOf(ThemeEvent::class, $event);
}
public function testJavascriptTranslations()
public function testJavascriptTranslations(): void
{
$sut = $this->getSut();
$values = $sut->getJavascriptTranslations();
@@ -145,13 +145,13 @@ class ThemeEventExtensionTest extends TestCase
/**
* @dataProvider getProgressbarColors
*/
public function testProgressbarClass(string $expected, int $percent, ?bool $reverseColors = false)
public function testProgressbarClass(string $expected, int $percent, ?bool $reverseColors = false): void
{
$sut = $this->getSut(false);
self::assertEquals($expected, $sut->getProgressbarClass($percent, $reverseColors));
}
public function testGetTitle()
public function testGetTitle(): void
{
$sut = $this->getSut(false);
$this->assertEquals('Kimai – foo', $sut->generateTitle());
@@ -160,7 +160,7 @@ class ThemeEventExtensionTest extends TestCase
$this->assertEquals('Kimai | foo', $sut->generateTitle(null, ' | '));
}
public function testGetBrandedTitle()
public function testGetBrandedTitle(): void
{
$sut = $this->getSut(false, 'MyCompany');
$this->assertEquals('Kimai – foo', $sut->generateTitle());

View File

@@ -22,7 +22,7 @@ use PHPUnit\Framework\TestCase;
*/
class TimesheetExtensionTest extends TestCase
{
public function testActiveEntries()
public function testActiveEntries(): void
{
$entries = [new Timesheet(), new Timesheet()];
@@ -36,7 +36,7 @@ class TimesheetExtensionTest extends TestCase
self::assertEquals($entries, $sut->activeEntries(new User()));
}
public function testRecentEntries()
public function testRecentEntries(): void
{
$timesheet1 = $this->createMock(Timesheet::class);
$timesheet1->method('getId')->willReturn(1);

View File

@@ -62,7 +62,7 @@ class WidgetExtensionTest extends TestCase
return $env;
}
public function testRenderWidgetForInvalidValue()
public function testRenderWidgetForInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Widget must be either a WidgetInterface or a string');
@@ -72,7 +72,7 @@ class WidgetExtensionTest extends TestCase
$sut->renderWidget($this->getEnvironment(), true);
}
public function testRenderWidgetForUnknownWidget()
public function testRenderWidgetForUnknownWidget(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown widget "test" requested');
@@ -81,7 +81,7 @@ class WidgetExtensionTest extends TestCase
$sut->renderWidget($this->getEnvironment(), 'test');
}
public function testRenderWidgetByString()
public function testRenderWidgetByString(): void
{
$widget = new More();
$widget->setId('test');
@@ -92,7 +92,7 @@ class WidgetExtensionTest extends TestCase
$this->assertEquals($options, $data);
}
public function testRenderWidgetObject()
public function testRenderWidgetObject(): void
{
$widget = new More();
$sut = $this->getSut(null, null);