Release 2.15 (#4749)

This commit is contained in:
Kevin Papst
2024-04-12 19:03:09 +02:00
committed by GitHub
parent b76a5d5c35
commit 7219b3f421
56 changed files with 441 additions and 575 deletions

View File

@@ -163,15 +163,6 @@ class SystemConfigurationTest extends TestCase
$this->assertEquals('2020-03-27', $sut->getFinancialYearStart());
}
public function testOffsetUnsetThrowsException(): void
{
$this->expectException(\BadMethodCallException::class);
$this->expectExceptionMessage('SystemBundleConfiguration does not support offsetUnset()');
$sut = $this->getSut($this->getDefaultSettings(), []);
$sut->offsetUnset('dfsdf');
}
public function testUnknownConfigs(): void
{
$sut = $this->getSut($this->getDefaultSettings(), [

View File

@@ -18,11 +18,11 @@ use App\Tests\Mocks\Saml\SamlAuthFactoryFactory;
use App\Tests\Mocks\SystemConfigurationFactory;
use OneLogin\Saml2\Auth;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
/**
* @group integration
@@ -127,7 +127,7 @@ class SamlControllerTest extends TestCase
$request = new Request();
$request->setSession($this->createMock(SessionInterface::class));
$request->attributes->set(Security::AUTHENTICATION_ERROR, new \Exception('My test error'));
$request->attributes->set(SecurityRequestAttributes::AUTHENTICATION_ERROR, new \Exception('My test error'));
$factory = $this->getMockBuilder(SamlAuthFactory::class)->disableOriginalConstructor()->getMock();

View File

@@ -35,7 +35,6 @@ class InvoiceTemplateTest extends TestCase
self::assertEquals('default', $sut->getNumberGenerator());
self::assertEquals('default', $sut->getRenderer());
self::assertEquals(30, $sut->getDueDays());
self::assertTrue($sut->isDecimalDuration());
}
public function testSetNullForOptionalValues(): void

View File

@@ -11,6 +11,7 @@ namespace App\Tests\Export\Spreadsheet\CellFormatter;
use App\Export\Spreadsheet\CellFormatter\CellFormatterInterface;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\CellAddress;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PHPUnit\Framework\TestCase;
@@ -42,7 +43,7 @@ abstract class AbstractFormatterTest extends TestCase
$sut->setFormattedValue($worksheet, 1, 1, $this->getActualValue());
$cell = $worksheet->getCell([1, 1]);
$this->assertCellValue($cell);
$this->assertCellStyle($worksheet->getStyleByColumnAndRow(1, 1));
$this->assertCellStyle($worksheet->getStyle(CellAddress::fromColumnAndRow(1, 1)));
}
public function testSetNull(): void

View File

@@ -52,6 +52,6 @@ class DateFormatterTest extends AbstractFormatterTest
public function assertCellStyle(Style $style): void
{
self::assertEquals(NumberFormat::FORMAT_DATE_YYYYMMDD2, $style->getNumberFormat()->getFormatCode());
self::assertEquals(NumberFormat::FORMAT_DATE_YYYYMMDD, $style->getNumberFormat()->getFormatCode());
}
}

View File

@@ -63,6 +63,7 @@ class InvoiceItemDefaultHydratorTest extends TestCase
'entry.end_time',
'entry.end_timestamp',
'entry.date',
'entry.date_process',
'entry.week',
'entry.weekyear',
'entry.user_id',

View File

@@ -37,6 +37,8 @@ class InvoiceModelActivityHydratorTest extends TestCase
'activity.id',
'activity.name',
'activity.comment',
'activity.number',
'activity.invoice_text',
'activity.meta.foo-activity',
'activity.budget_open',
'activity.budget_open_plain',
@@ -45,6 +47,8 @@ class InvoiceModelActivityHydratorTest extends TestCase
'activity.1.id',
'activity.1.name',
'activity.1.comment',
'activity.1.number',
'activity.1.invoice_text',
'activity.1.meta.foo-activity',
'activity.1.budget_open',
'activity.1.budget_open_plain',

View File

@@ -37,6 +37,8 @@ class InvoiceModelProjectHydratorTest extends TestCase
'project.id',
'project.name',
'project.comment',
'project.number',
'project.invoice_text',
'project.order_date',
'project.order_number',
'project.meta.foo-project',
@@ -55,6 +57,8 @@ class InvoiceModelProjectHydratorTest extends TestCase
'project.1.id',
'project.1.name',
'project.1.comment',
'project.1.number',
'project.1.invoice_text',
'project.1.order_date',
'project.1.order_number',
'project.1.meta.foo-project',

View File

@@ -152,6 +152,8 @@ class DebugRendererTest extends TestCase
'activity.id',
'activity.name',
'activity.comment',
'activity.number',
'activity.invoice_text',
'activity.meta.foo-activity',
'activity.budget_open',
'activity.budget_open_plain',
@@ -184,6 +186,8 @@ class DebugRendererTest extends TestCase
'activity.1.id',
'activity.1.name',
'activity.1.comment',
'activity.1.number',
'activity.1.invoice_text',
'activity.1.meta.foo-activity',
]);
}
@@ -201,6 +205,8 @@ class DebugRendererTest extends TestCase
'project.id',
'project.name',
'project.comment',
'project.number',
'project.invoice_text',
'project.order_date',
'project.order_number',
'project.meta.foo-project',
@@ -223,6 +229,8 @@ class DebugRendererTest extends TestCase
'project.1.id',
'project.1.name',
'project.1.comment',
'project.1.number',
'project.1.invoice_text',
'project.1.order_date',
'project.1.order_number',
'project.1.meta.foo-project',
@@ -276,6 +284,7 @@ class DebugRendererTest extends TestCase
'entry.end_time',
'entry.end_timestamp',
'entry.date',
'entry.date_process',
'entry.week',
'entry.weekyear',
'entry.user_id',

View File

@@ -116,9 +116,9 @@ class PdfRendererTest extends KernelTestCase
$dirs = [
__DIR__ . '/../../../templates/invoice/renderer/',
__DIR__ . '/../../../var/invoices/',
__DIR__ . '/../../../var/invoices_customer/',
__DIR__ . '/../../../var/invoices_old/',
//__DIR__ . '/../../../var/invoices/',
//__DIR__ . '/../../../var/invoices_customer/',
//__DIR__ . '/../../../var/invoices_old/',
];
$files = [];

View File

@@ -200,8 +200,8 @@ class ServiceInvoiceTest extends TestCase
self::assertNotNull($query->getBegin());
self::assertNotNull($query->getEnd());
self::assertEquals('2010-01-27T00:00:00+0100', $query->getBegin()->format(DATE_ISO8601));
self::assertEquals('2020-11-27T23:59:59+0100', $query->getEnd()->format(DATE_ISO8601));
self::assertEquals('2010-01-27T00:00:00+01:00', $query->getBegin()->format(DATE_ATOM));
self::assertEquals('2020-11-27T23:59:59+01:00', $query->getEnd()->format(DATE_ATOM));
}
public function testCreateModelsIncludesModelsWithNegativeTotal(): void

View File

@@ -271,7 +271,7 @@ class LocaleFormatExtensionsTest extends TestCase
$user->setTimezone('Asia/Dubai');
$date = $sut->createDate('2019-08-27 16:30:45', $user);
$this->assertEquals('2019-08-27T16:30:45+0400', $date->format(DATE_ISO8601));
$this->assertEquals('2019-08-27T16:30:45+04:00', $date->format(DATE_ATOM));
$this->assertEquals('Asia/Dubai', $date->getTimezone()->getName());
$date = $sut->createDate('2019-08-27 16:30:45', null);

View File

@@ -9,11 +9,8 @@
namespace App\Tests\Widget\Type;
use App\Entity\Activity;
use App\Entity\Project;
use App\Entity\User;
use App\Model\Statistic\Day;
use App\Widget\DataProvider\DailyWorkingTimeChartProvider;
use App\Repository\TimesheetRepository;
use App\Widget\Type\DailyWorkingTimeChart;
use App\Widget\WidgetInterface;
use PHPUnit\Framework\TestCase;
@@ -27,7 +24,7 @@ class DailyWorkingTimeChartTest extends TestCase
{
public function createSut(): DailyWorkingTimeChart
{
$repository = $this->createMock(DailyWorkingTimeChartProvider::class);
$repository = $this->createMock(TimesheetRepository::class);
$sut = new DailyWorkingTimeChart($repository);
$sut->setUser(new User());
@@ -65,54 +62,4 @@ class DailyWorkingTimeChartTest extends TestCase
self::assertStringStartsWith('DailyWorkingTimeChart_', $options['id']);
self::assertEquals('xxx', $options['type']);
}
public function testGetData(): void
{
$activity = $this->createMock(Activity::class);
$activity->method('getId')->willReturn(42);
$project = $this->createMock(Project::class);
$project->method('getId')->willReturn(4711);
$repository = $this->getMockBuilder(DailyWorkingTimeChartProvider::class)->disableOriginalConstructor()->onlyMethods(['getDailyData'])->getMock();
$repository->expects($this->once())->method('getDailyData')->willReturnCallback(function ($begin, $end, $user) use ($activity, $project) {
return [
[
'year' => $begin->format('Y'),
'month' => $begin->format('n'),
'day' => $begin->format('j'),
'rate' => 13.75,
'duration' => 1234,
'billable' => 1234,
'details' => [
[
'activity' => $activity,
'project' => $project,
'billable' => 1234,
]
]
]
];
});
$sut = new DailyWorkingTimeChart($repository);
$sut->setUser(new User());
$data = $sut->getData($sut->getOptions());
self::assertCount(2, $data);
self::assertArrayHasKey('activities', $data);
self::assertArrayHasKey('data', $data);
self::assertCount(1, $data['activities']);
self::assertArrayHasKey('4711_42', $data['activities']);
self::assertCount(2, $data['activities']['4711_42']);
self::assertArrayHasKey('activity', $data['activities']['4711_42']);
self::assertArrayHasKey('project', $data['activities']['4711_42']);
self::assertSame($activity, $data['activities']['4711_42']['activity']);
self::assertSame($project, $data['activities']['4711_42']['project']);
self::assertCount(7, $data['data']);
foreach ($data['data'] as $statObj) {
self::assertInstanceOf(Day::class, $statObj);
}
}
}

View File

@@ -5,6 +5,7 @@ includes:
- %rootDir%/../phpstan-doctrine/rules.neon
- %rootDir%/../phpstan-phpunit/extension.neon
- %rootDir%/../phpstan-phpunit/rules.neon
- %rootDir%/../phpstan-deprecation-rules/rules.neon
parameters:
level: 9
@@ -4132,16 +4133,6 @@ parameters:
count: 1
path: Widget/Type/AmountYearTest.php
-
message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) expects array\\|ArrayAccess, mixed given\\.$#"
count: 1
path: Widget/Type/DailyWorkingTimeChartTest.php
-
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertCount\\(\\) expects Countable\\|iterable, mixed given\\.$#"
count: 1
path: Widget/Type/DailyWorkingTimeChartTest.php
-
message: "#^Method App\\\\Tests\\\\Widget\\\\Type\\\\DurationYearTest\\:\\:getDefaultOptions\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1