Release 2.9.0 (#4526)

* added fix to work around bc break in new phpword version
* fix phpoffice deprecations
* mark unused option as deprecated
* support for DateTimeInterface and DateTimeImmutable where possible
* use TRUSTED_PROXIES setting - fixes #4533
* re-enable Kimai test in docker test build script (#4541)
* bump dependencies
This commit is contained in:
Kevin Papst
2024-01-10 12:43:07 +01:00
committed by GitHub
parent c6a651456e
commit 6531e7fe52
46 changed files with 487 additions and 485 deletions

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
*/
class ActivityBudgetStatisticEventTest extends TestCase
{
public function testStatistic()
public function testStatistic(): void
{
$activity = $this->createMock(Activity::class);
$activity->expects($this->exactly(2))->method('getId')->willReturn(12);
@@ -39,7 +39,7 @@ class ActivityBudgetStatisticEventTest extends TestCase
self::assertNull($sut->getModel(1));
self::assertSame($model1, $sut->getModel(12));
self::assertSame($model2, $sut->getModel(4));
self::assertSame($begin, $sut->getBegin());
self::assertSame($end, $sut->getEnd());
self::assertEquals($begin, $sut->getBegin());
self::assertEquals($end, $sut->getEnd());
}
}

View File

@@ -25,7 +25,7 @@ class ActivityStatisticEventTest extends AbstractActivityEventTest
return new ActivityStatisticEvent($activity, new ActivityStatistic());
}
public function testStatistic()
public function testStatistic(): void
{
$activity = new Activity();
$statistic = new ActivityStatistic();
@@ -39,7 +39,7 @@ class ActivityStatisticEventTest extends AbstractActivityEventTest
$begin = new \DateTime('2020-08-08 12:34:56');
$end = new \DateTime('2020-09-08 12:34:56');
$sut = new ActivityStatisticEvent($activity, $statistic, $begin, $end);
self::assertSame($begin, $sut->getBegin());
self::assertSame($end, $sut->getEnd());
self::assertEquals($begin, $sut->getBegin());
self::assertEquals($end, $sut->getEnd());
}
}

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
*/
class ProjectBudgetStatisticEventTest extends TestCase
{
public function testStatistic()
public function testStatistic(): void
{
$project = $this->createMock(Project::class);
$project->expects($this->exactly(2))->method('getId')->willReturn(12);
@@ -39,7 +39,7 @@ class ProjectBudgetStatisticEventTest extends TestCase
self::assertNull($sut->getModel(1));
self::assertSame($model1, $sut->getModel(12));
self::assertSame($model2, $sut->getModel(4));
self::assertSame($begin, $sut->getBegin());
self::assertSame($end, $sut->getEnd());
self::assertEquals($begin, $sut->getBegin());
self::assertEquals($end, $sut->getEnd());
}
}

View File

@@ -25,7 +25,7 @@ class ProjectStatisticEventTest extends AbstractProjectEventTest
return new ProjectStatisticEvent($project, new ProjectStatistic());
}
public function testStatistic()
public function testStatistic(): void
{
$project = new Project();
$statistic = new ProjectStatistic();
@@ -36,8 +36,8 @@ class ProjectStatisticEventTest extends AbstractProjectEventTest
self::assertNull($sut->getBegin());
self::assertNull($sut->getEnd());
$begin = new \DateTime('2020-08-08 12:34:56');
$end = new \DateTime('2020-09-08 12:34:56');
$begin = new \DateTimeImmutable('2020-08-08 12:34:56');
$end = new \DateTimeImmutable('2020-09-08 12:34:56');
$sut = new ProjectStatisticEvent($project, $statistic, $begin, $end);
self::assertSame($begin, $sut->getBegin());
self::assertSame($end, $sut->getEnd());

View File

@@ -41,7 +41,7 @@ class DateFormatterTest extends AbstractFormatterTest
public function testFormattedValueWithInvalidValue()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only DateTime is supported');
$this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported');
$spreadsheet = new Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();

View File

@@ -40,7 +40,7 @@ class DateTimeFormatterTest extends AbstractFormatterTest
public function testFormattedValueWithInvalidValue()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only DateTime is supported');
$this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported');
$spreadsheet = new Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();

View File

@@ -40,7 +40,7 @@ class TimeFormatterTest extends AbstractFormatterTest
public function testFormattedValueWithInvalidValue()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported value given, only DateTime is supported');
$this->expectExceptionMessage('Unsupported value given, only DateTimeInterface is supported');
$spreadsheet = new Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();

View File

@@ -22,7 +22,7 @@ class DocxRendererTest extends TestCase
{
use RendererTestTrait;
public function testSupports()
public function testSupports(): void
{
$sut = $this->getAbstractRenderer(DocxRenderer::class);
@@ -34,7 +34,7 @@ class DocxRendererTest extends TestCase
$this->assertFalse($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods', true)));
}
public function testRender()
public function testRender(): void
{
/** @var DocxRenderer $sut */
$sut = $this->getAbstractRenderer(DocxRenderer::class);
@@ -48,7 +48,7 @@ class DocxRendererTest extends TestCase
$this->assertEquals('application/vnd.openxmlformats-officedocument.wordprocessingml.document', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename=' . $filename, $response->headers->get('Content-Disposition'));
$this->assertTrue(file_exists($file->getRealPath()));
$this->assertTrue(file_exists($file->getPathname()));
ob_start();
$response->sendContent();

View File

@@ -17,6 +17,7 @@ use App\Entity\Team;
use App\Form\Model\DateRange;
use App\Repository\Query\ActivityQuery;
use App\Repository\Query\BaseQuery;
use App\Repository\Query\DateRangeInterface;
use App\Repository\Query\ProjectQuery;
use App\Repository\Query\TimesheetQuery;
use App\Utils\SearchTerm;
@@ -334,7 +335,7 @@ class BaseQueryTest extends TestCase
$this->assertEquals([13, 27], $sut->getProjectIds());
}
protected function assertDateRangeTrait($sut): void
protected function assertDateRangeTrait(DateRangeInterface $sut): void
{
self::assertNull($sut->getBegin());
self::assertNull($sut->getEnd());
@@ -346,14 +347,15 @@ class BaseQueryTest extends TestCase
self::assertNull($sut->getBegin());
self::assertNull($sut->getEnd());
$begin = new \DateTime('2013-11-23 13:45:07');
$end = new \DateTime('2014-01-01 23:45:11');
$dateRange->setBegin($begin);
$dateRange->setEnd($end);
$dateRange->setBegin(new \DateTimeImmutable('2013-11-23 13:45:07'));
$dateRange->setEnd(new \DateTimeImmutable('2014-01-01 23:45:11'));
self::assertSame($begin, $sut->getDateRange()->getBegin());
self::assertSame($begin, $sut->getBegin());
self::assertSame($end, $sut->getDateRange()->getEnd());
self::assertSame($end, $sut->getEnd());
$begin1 = new \DateTimeImmutable('2013-11-23 00:00:00');
$end1 = new \DateTimeImmutable('2014-01-01 23:59:59');
self::assertEquals($begin1, $sut->getDateRange()->getBegin());
self::assertEquals($begin1, $sut->getBegin());
self::assertEquals($end1, $sut->getDateRange()->getEnd());
self::assertEquals($end1, $sut->getEnd());
}
}

View File

@@ -4072,11 +4072,6 @@ parameters:
count: 1
path: Event/AbstractTimesheetMultipleEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\ActivityBudgetStatisticEventTest\\:\\:testStatistic\\(\\) has no return type specified\\.$#"
count: 1
path: Event/ActivityBudgetStatisticEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\ActivityMetaDefinitionEventTest\\:\\:testGetterAndSetter\\(\\) has no return type specified\\.$#"
count: 1
@@ -4087,11 +4082,6 @@ parameters:
count: 1
path: Event/ActivityMetaDisplayEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\ActivityStatisticEventTest\\:\\:testStatistic\\(\\) has no return type specified\\.$#"
count: 1
path: Event/ActivityStatisticEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\CalendarConfigurationEventTest\\:\\:testGetterAndSetter\\(\\) has no return type specified\\.$#"
count: 1
@@ -4202,11 +4192,6 @@ parameters:
count: 5
path: Event/PermissionsEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\ProjectBudgetStatisticEventTest\\:\\:testStatistic\\(\\) has no return type specified\\.$#"
count: 1
path: Event/ProjectBudgetStatisticEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\ProjectMetaDefinitionEventTest\\:\\:testGetterAndSetter\\(\\) has no return type specified\\.$#"
count: 1
@@ -4222,11 +4207,6 @@ parameters:
count: 1
path: Event/ProjectMetaQueryDisplayTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\ProjectStatisticEventTest\\:\\:testStatistic\\(\\) has no return type specified\\.$#"
count: 1
path: Event/ProjectStatisticEventTest.php
-
message: "#^Method App\\\\Tests\\\\Event\\\\RecentActivityEventTest\\:\\:testGetterAndSetter\\(\\) has no return type specified\\.$#"
count: 1
@@ -5912,16 +5892,6 @@ parameters:
count: 1
path: Invoice/Renderer/DocxRendererTest.php
-
message: "#^Method App\\\\Tests\\\\Invoice\\\\Renderer\\\\DocxRendererTest\\:\\:testRender\\(\\) has no return type specified\\.$#"
count: 1
path: Invoice/Renderer/DocxRendererTest.php
-
message: "#^Method App\\\\Tests\\\\Invoice\\\\Renderer\\\\DocxRendererTest\\:\\:testSupports\\(\\) has no return type specified\\.$#"
count: 1
path: Invoice/Renderer/DocxRendererTest.php
-
message: "#^Method App\\\\Tests\\\\Invoice\\\\Renderer\\\\OdsRendererTest\\:\\:getAbstractRenderer\\(\\) should return App\\\\Invoice\\\\Renderer\\\\AbstractRenderer but returns object\\.$#"
count: 1
@@ -6907,11 +6877,6 @@ parameters:
count: 1
path: Repository/Query/BaseQueryTest.php
-
message: "#^Method App\\\\Tests\\\\Repository\\\\Query\\\\BaseQueryTest\\:\\:assertDateRangeTrait\\(\\) has parameter \\$sut with no type specified\\.$#"
count: 1
path: Repository/Query/BaseQueryTest.php
-
message: "#^Method App\\\\Tests\\\\Repository\\\\Query\\\\BaseQueryTest\\:\\:assertOrder\\(\\) has parameter \\$order with no type specified\\.$#"
count: 1