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

@@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
*/
class ExportFilenameTest extends TestCase
{
public function testExportFilename()
public function testExportFilename(): void
{
$datePrefix = date('Ymd');

View File

@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
*/
class CsvRendererTest extends AbstractRendererTest
{
public function testConfiguration()
public function testConfiguration(): void
{
$sut = $this->getAbstractRenderer(CsvRenderer::class);
@@ -40,7 +40,7 @@ class CsvRendererTest extends AbstractRendererTest
/**
* @dataProvider getTestModel
*/
public function testRender($totalDuration, $totalRate, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3)
public function testRender($totalDuration, $totalRate, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3): void
{
$sut = $this->getAbstractRenderer(CsvRenderer::class);

View File

@@ -22,7 +22,7 @@ use Twig\Environment;
*/
class HtmlRendererFactoryTest extends TestCase
{
public function testCreate()
public function testCreate(): void
{
$sut = new HtmlRendererFactory(
$this->createMock(Environment::class),

View File

@@ -28,7 +28,7 @@ use Twig\Environment;
*/
class HtmlRendererTest extends AbstractRendererTest
{
public function testConfiguration()
public function testConfiguration(): void
{
$sut = new HtmlRenderer(
$this->createMock(Environment::class),
@@ -42,7 +42,7 @@ class HtmlRendererTest extends AbstractRendererTest
$this->assertEquals('print', $sut->getIcon());
}
public function testRender()
public function testRender(): void
{
/** @var Environment $twig */
$twig = self::getContainer()->get('twig');

View File

@@ -21,7 +21,7 @@ use Twig\Environment;
*/
class PdfRendererFactoryTest extends TestCase
{
public function testCreate()
public function testCreate(): void
{
$sut = new PdfRendererFactory(
$this->createMock(Environment::class),

View File

@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
*/
class XlsxRendererTest extends AbstractRendererTest
{
public function testConfiguration()
public function testConfiguration(): void
{
$sut = $this->getAbstractRenderer(XlsxRenderer::class);
@@ -30,7 +30,7 @@ class XlsxRendererTest extends AbstractRendererTest
$this->assertEquals('xlsx', $sut->getIcon());
}
public function testRender()
public function testRender(): void
{
$sut = $this->getAbstractRenderer(XlsxRenderer::class);

View File

@@ -37,7 +37,7 @@ class ServiceExportTest extends TestCase
);
}
public function testEmptyObject()
public function testEmptyObject(): void
{
$sut = $this->createSut();
@@ -48,7 +48,7 @@ class ServiceExportTest extends TestCase
self::assertNull($sut->getTimesheetExporterById('default'));
}
public function testAddRenderer()
public function testAddRenderer(): void
{
$sut = $this->createSut();
@@ -64,7 +64,7 @@ class ServiceExportTest extends TestCase
self::assertSame($renderer, $sut->getRendererById('html'));
}
public function testAddTimesheetExporter()
public function testAddTimesheetExporter(): void
{
$sut = $this->createSut();
@@ -75,7 +75,7 @@ class ServiceExportTest extends TestCase
self::assertSame($exporter, $sut->getTimesheetExporterById('print'));
}
public function testAddExportRepository()
public function testAddExportRepository(): void
{
$sut = $this->createSut();

View File

@@ -22,7 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class AnnotatedObjectExporterTest extends TestCase
{
public function testExport()
public function testExport(): void
{
$spreadsheetExporter = new SpreadsheetExporter($this->createMock(TranslatorInterface::class));
$annotationExtractor = new AnnotationExtractor();

View File

@@ -23,16 +23,16 @@ abstract class AbstractFormatterTest extends TestCase
abstract protected function getExpectedValue();
protected function assertCellStyle(Style $style)
public function assertCellStyle(Style $style): void
{
}
protected function assertCellValue(Cell $cell)
public function assertCellValue(Cell $cell): void
{
self::assertEquals($this->getExpectedValue(), $cell->getValue());
}
public function testSetFormattedValue()
public function testSetFormattedValue(): void
{
$sut = $this->getFormatter();
@@ -45,7 +45,7 @@ abstract class AbstractFormatterTest extends TestCase
$this->assertCellStyle($worksheet->getStyleByColumnAndRow(1, 1));
}
public function testSetNull()
public function testSetNull(): void
{
$sut = $this->getFormatter();
@@ -57,7 +57,7 @@ abstract class AbstractFormatterTest extends TestCase
$this->assertNullValue($cell);
}
protected function assertNullValue(Cell $cell)
public function assertNullValue(Cell $cell): void
{
self::assertEquals('', $cell->getValue());
}

View File

@@ -33,7 +33,7 @@ class ArrayFormatterTest extends AbstractFormatterTest
return 'test;foo;bar';
}
public function testFormattedValueWithInvalidValue()
public function testFormattedValueWithInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only array is supported');

View File

@@ -33,7 +33,7 @@ class BooleanFormatterTest extends AbstractFormatterTest
return false;
}
public function testFormattedValueWithInvalidValue()
public function testFormattedValueWithInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only boolean is supported');

View File

@@ -38,7 +38,7 @@ class DateFormatterTest extends AbstractFormatterTest
return Date::PHPToExcel($this->date);
}
public function testFormattedValueWithInvalidValue()
public function testFormattedValueWithInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported');
@@ -50,7 +50,7 @@ class DateFormatterTest extends AbstractFormatterTest
$sut->setFormattedValue($worksheet, 1, 1, 'sdfsdf');
}
protected function assertCellStyle(Style $style)
public function assertCellStyle(Style $style): void
{
self::assertEquals(NumberFormat::FORMAT_DATE_YYYYMMDD2, $style->getNumberFormat()->getFormatCode());
}

View File

@@ -37,7 +37,7 @@ class DateTimeFormatterTest extends AbstractFormatterTest
return Date::PHPToExcel($this->date);
}
public function testFormattedValueWithInvalidValue()
public function testFormattedValueWithInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported');
@@ -49,7 +49,7 @@ class DateTimeFormatterTest extends AbstractFormatterTest
$sut->setFormattedValue($worksheet, 1, 1, 'sdfsdf');
}
protected function assertCellStyle(Style $style)
public function assertCellStyle(Style $style): void
{
self::assertEquals(DateTimeFormatter::DATETIME_FORMAT, $style->getNumberFormat()->getFormatCode());
}

View File

@@ -35,7 +35,7 @@ class DurationFormatterTest extends AbstractFormatterTest
return '=3600/86400';
}
public function testFormattedValueWithInvalidValue()
public function testFormattedValueWithInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only int is supported');
@@ -47,12 +47,12 @@ class DurationFormatterTest extends AbstractFormatterTest
$sut->setFormattedValue($worksheet, 1, 1, 'sdfsdf');
}
protected function assertNullValue(Cell $cell)
public function assertNullValue(Cell $cell): void
{
self::assertEquals('=0/86400', $cell->getValue());
}
protected function assertCellStyle(Style $style)
public function assertCellStyle(Style $style): void
{
self::assertEquals(DurationFormatter::DURATION_FORMAT, $style->getNumberFormat()->getFormatCode());
}

View File

@@ -37,7 +37,7 @@ class TimeFormatterTest extends AbstractFormatterTest
return Date::PHPToExcel($this->date);
}
public function testFormattedValueWithInvalidValue()
public function testFormattedValueWithInvalidValue(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported');
@@ -49,7 +49,7 @@ class TimeFormatterTest extends AbstractFormatterTest
$sut->setFormattedValue($worksheet, 1, 1, 'sdfsdf');
}
protected function assertCellStyle(Style $style)
public function assertCellStyle(Style $style): void
{
self::assertEquals(TimeFormatter::TIME_FORMAT, $style->getNumberFormat()->getFormatCode());
}

View File

@@ -16,7 +16,7 @@ use PHPUnit\Framework\TestCase;
*/
class ColumnDefinitionTest extends TestCase
{
public function testConstruct()
public function testConstruct(): void
{
$sut = new \App\Export\Spreadsheet\ColumnDefinition('foo', 'bar', function () {
return 'hello world';

View File

@@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class EntityWithMetaFieldsExporterTest extends TestCase
{
public function testExport()
public function testExport(): void
{
$dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects(self::once())->method('dispatch')->willReturnCallback(function (ProjectMetaDisplayEvent $event) {

View File

@@ -28,7 +28,7 @@ use PHPUnit\Framework\TestCase;
*/
class AnnotationExtractorTest extends TestCase
{
public function testExtract()
public function testExtract(): void
{
$sut = new AnnotationExtractor();
@@ -70,7 +70,7 @@ class AnnotationExtractorTest extends TestCase
}
}
public function testExceptionOnInvalidType()
public function testExceptionOnInvalidType(): void
{
$sut = new AnnotationExtractor();
@@ -81,7 +81,7 @@ class AnnotationExtractorTest extends TestCase
$sut->extract(new \stdClass());
}
public function testExceptionOnEmptyString()
public function testExceptionOnEmptyString(): void
{
$sut = new AnnotationExtractor();
@@ -91,7 +91,7 @@ class AnnotationExtractorTest extends TestCase
$sut->extract('');
}
public function testExceptionOnMissingExpression()
public function testExceptionOnMissingExpression(): void
{
$sut = new AnnotationExtractor();
@@ -101,7 +101,7 @@ class AnnotationExtractorTest extends TestCase
$sut->extract(MissingExpressionOnClass::class);
}
public function testExceptionOnMissingName()
public function testExceptionOnMissingName(): void
{
$sut = new AnnotationExtractor();
@@ -111,7 +111,7 @@ class AnnotationExtractorTest extends TestCase
$sut->extract(MissingNameOnClass::class);
}
public function testExceptionExpressionOnProperty()
public function testExceptionExpressionOnProperty(): void
{
$sut = new AnnotationExtractor();
@@ -121,7 +121,7 @@ class AnnotationExtractorTest extends TestCase
$sut->extract(ExpressionOnProperty::class);
}
public function testExceptionExpressionOnMethod()
public function testExceptionExpressionOnMethod(): void
{
$sut = new AnnotationExtractor();
@@ -131,7 +131,7 @@ class AnnotationExtractorTest extends TestCase
$sut->extract(ExpressionOnMethod::class);
}
public function testExceptionExpressionOnMethodWithRequiredParameters()
public function testExceptionExpressionOnMethodWithRequiredParameters(): void
{
$sut = new AnnotationExtractor();

View File

@@ -25,7 +25,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
*/
class MetaFieldExtractorTest extends TestCase
{
public function testExtract()
public function testExtract(): void
{
$dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects(self::once())->method('dispatch')->willReturnCallback(function (ProjectMetaDisplayEvent $event) {
@@ -55,7 +55,7 @@ class MetaFieldExtractorTest extends TestCase
self::assertEquals('tralalalala', \call_user_func($definition->getAccessor(), (new Project())->setMetaField((new ProjectMeta())->setName('bar')->setValue('tralalalala'))));
}
public function testCheckType()
public function testCheckType(): void
{
$dispatcher = $this->createMock(EventDispatcherInterface::class);
$sut = new MetaFieldExtractor($dispatcher);

View File

@@ -24,7 +24,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
*/
class UserPreferenceExtractorTest extends TestCase
{
public function testExtract()
public function testExtract(): void
{
$dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects(self::once())->method('dispatch')->willReturnCallback(function (UserPreferenceDisplayEvent $event) {
@@ -54,7 +54,7 @@ class UserPreferenceExtractorTest extends TestCase
self::assertEquals('tralalalala', \call_user_func($definition->getAccessor(), (new User())->addPreference((new UserPreference('bar', 'tralalalala')))));
}
public function testCheckType()
public function testCheckType(): void
{
$dispatcher = $this->createMock(EventDispatcherInterface::class);
$sut = new UserPreferenceExtractor($dispatcher);

View File

@@ -22,7 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class SpreadsheetExporterTest extends TestCase
{
public function testExport()
public function testExport(): void
{
$sut = new SpreadsheetExporter($this->createMock(TranslatorInterface::class));
$sut->registerCellFormatter('foo', new class() implements CellFormatterInterface {

View File

@@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class UserExporterTest extends TestCase
{
public function testExport()
public function testExport(): void
{
$spreadsheetExporter = new SpreadsheetExporter($this->createMock(TranslatorInterface::class));
$annotationExtractor = new AnnotationExtractor();

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
*/
class BinaryFileResponseWriterTest extends TestCase
{
public function testSave()
public function testSave(): void
{
$sut = new BinaryFileResponseWriter(new XlsxWriter(), 'foobar');
@@ -33,7 +33,7 @@ class BinaryFileResponseWriterTest extends TestCase
self::assertTrue(file_exists($file->getRealPath()));
}
public function testGetResponse()
public function testGetResponse(): void
{
$sut = new BinaryFileResponseWriter(new XlsxWriter(), 'foobar');

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/
class XlsxWriterTest extends TestCase
{
public function testWriter()
public function testWriter(): void
{
$sut = new XlsxWriter();

View File

@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
*/
class CsvRendererTest extends AbstractRendererTest
{
public function testConfiguration()
public function testConfiguration(): void
{
$sut = $this->getAbstractRenderer(CsvRenderer::class);
@@ -38,7 +38,7 @@ class CsvRendererTest extends AbstractRendererTest
/**
* @dataProvider getTestModel
*/
public function testRender($totalDuration, $totalRate, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3)
public function testRender($totalDuration, $totalRate, $expectedRate, $expectedRows, $expectedDescriptions, $expectedUser1, $expectedUser2, $expectedUser3): void
{
$sut = $this->getAbstractRenderer(CsvRenderer::class);

View File

@@ -21,14 +21,14 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
*/
class XlsxRendererTest extends AbstractRendererTest
{
public function testConfiguration()
public function testConfiguration(): void
{
$sut = $this->getAbstractRenderer(XlsxRenderer::class);
$this->assertEquals('xlsx', $sut->getId());
}
public function testRender()
public function testRender(): void
{
$sut = $this->getAbstractRenderer(XlsxRenderer::class);

View File

@@ -22,7 +22,7 @@ use PHPUnit\Framework\TestCase;
*/
class TimesheetExportRepositoryTest extends TestCase
{
public function testSetExported()
public function testSetExported(): void
{
$repository = $this->createMock(TimesheetRepository::class);
$repository->expects($this->once())->method('setExported')->willReturnCallback(function (array $items) {
@@ -37,7 +37,7 @@ class TimesheetExportRepositoryTest extends TestCase
$sut->setExported([new Customer('foo'), new Project()]);
}
public function testSetType()
public function testSetType(): void
{
$repository = $this->createMock(TimesheetRepository::class);
$sut = new TimesheetExportRepository($repository);