Release 2.2.0 (#4359)
* deactivate deprecation logging in prod for now * fix several deprecations * enable CSRF for logout * allow more twig methods and functions in InvoiceSecurity policy
This commit is contained in:
@@ -24,14 +24,17 @@ class SystemConfigurationTest extends TestCase
|
||||
* @param array $loaderSettings
|
||||
* @return SystemConfiguration
|
||||
*/
|
||||
protected function getSut(array $settings, array $loaderSettings = [])
|
||||
protected function getSut(array $settings, array $loaderSettings = []): SystemConfiguration
|
||||
{
|
||||
$loader = new TestConfigLoader($loaderSettings);
|
||||
|
||||
return SystemConfigurationFactory::create($loader, $settings);
|
||||
}
|
||||
|
||||
protected function getDefaultSettings()
|
||||
/**
|
||||
* @return array<string, array<mixed>>
|
||||
*/
|
||||
protected function getDefaultSettings(): array
|
||||
{
|
||||
return [
|
||||
'timesheet' => [
|
||||
@@ -106,7 +109,10 @@ class SystemConfigurationTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
protected function getDefaultLoaderSettings()
|
||||
/**
|
||||
* @return array<Configuration>
|
||||
*/
|
||||
protected function getDefaultLoaderSettings(): array
|
||||
{
|
||||
return [
|
||||
(new Configuration())->setName('defaults.customer.timezone')->setValue('Russia/Moscov'),
|
||||
@@ -123,7 +129,7 @@ class SystemConfigurationTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testDefaultWithoutLoader()
|
||||
public function testDefaultWithoutLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals('Europe/London', $sut->find('defaults.customer.timezone'));
|
||||
@@ -133,7 +139,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals('Maroon|#800000,Brown|#a52a2a,Red|#ff0000,Orange|#ffa500,#ffffff,,|#000000', $sut->getThemeColorChoices());
|
||||
}
|
||||
|
||||
public function testDefaultWithLoader()
|
||||
public function testDefaultWithLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
|
||||
$this->assertEquals('Russia/Moscov', $sut->find('defaults.customer.timezone'));
|
||||
@@ -143,7 +149,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertFalse($sut->isSamlActive());
|
||||
}
|
||||
|
||||
public function testDefaultWithMixedConfigs()
|
||||
public function testDefaultWithMixedConfigs(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), [
|
||||
(new Configuration())->setName('timesheet.rules.allow_future_times')->setValue(''),
|
||||
@@ -157,7 +163,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals('2020-03-27', $sut->getFinancialYearStart());
|
||||
}
|
||||
|
||||
public function testOffsetUnsetThrowsException()
|
||||
public function testOffsetUnsetThrowsException(): void
|
||||
{
|
||||
$this->expectException(\BadMethodCallException::class);
|
||||
$this->expectExceptionMessage('SystemBundleConfiguration does not support offsetUnset()');
|
||||
@@ -166,7 +172,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$sut->offsetUnset('dfsdf');
|
||||
}
|
||||
|
||||
public function testUnknownConfigs()
|
||||
public function testUnknownConfigs(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), [
|
||||
(new Configuration())->setName('timesheet.foo')->setValue('hello'),
|
||||
@@ -182,7 +188,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals('foooo-bar!', $sut->find('xxxxxxxx.yyyyyyyyy'));
|
||||
}
|
||||
|
||||
public function testCalendarWithoutLoader()
|
||||
public function testCalendarWithoutLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals('07:49', $sut->getCalendarBusinessTimeBegin());
|
||||
@@ -199,7 +205,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals(2, \count($sources));
|
||||
}
|
||||
|
||||
public function testCalendarWithLoader()
|
||||
public function testCalendarWithLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
|
||||
$this->assertEquals('00:30:00', $sut->getCalendarSlotDuration());
|
||||
@@ -207,7 +213,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals(2, \count($sources));
|
||||
}
|
||||
|
||||
public function testFormDefaultWithoutLoader()
|
||||
public function testFormDefaultWithoutLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals('Europe/London', $sut->getCustomerDefaultTimezone());
|
||||
@@ -220,7 +226,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertNull($sut->getFinancialYearStart());
|
||||
}
|
||||
|
||||
public function testFormDefaultWithLoader()
|
||||
public function testFormDefaultWithLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
|
||||
$this->assertEquals('Russia/Moscov', $sut->getCustomerDefaultTimezone());
|
||||
@@ -232,7 +238,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals('USD', $sut->getUserDefaultCurrency());
|
||||
}
|
||||
|
||||
public function testTimesheetWithoutLoader()
|
||||
public function testTimesheetWithoutLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals(99, $sut->getTimesheetActiveEntriesHardLimit());
|
||||
@@ -250,7 +256,7 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals(5, $sut->getTimesheetIncrementMinutes());
|
||||
}
|
||||
|
||||
public function testTimesheetWithLoader()
|
||||
public function testTimesheetWithLoader(): void
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
|
||||
$this->assertEquals(7, $sut->getTimesheetActiveEntriesHardLimit());
|
||||
|
||||
@@ -38,7 +38,7 @@ class LayoutControllerTest extends ControllerBaseTest
|
||||
$this->assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '"', $content);
|
||||
$this->assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '/edit"', $content);
|
||||
$this->assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '/prefs"', $content);
|
||||
$this->assertStringContainsString('href="/en/logout"', $content);
|
||||
$this->assertStringContainsString('href="/en/logout?_csrf_token=', $content);
|
||||
}
|
||||
|
||||
protected function assertHasNavigation(HttpKernelBrowser $client)
|
||||
|
||||
@@ -183,7 +183,7 @@ class TimesheetTest extends TestCase
|
||||
$sut->setExported(true);
|
||||
$sut->setDescription('Invalid timesheet category "foo" given, expected one of: work, holiday, sickness, parental, overtime');
|
||||
|
||||
$modifiedDate = new \DateTime();
|
||||
$modifiedDate = new \DateTimeImmutable();
|
||||
|
||||
$reflection = new \ReflectionClass($sut);
|
||||
$property = $reflection->getProperty('modifiedAt');
|
||||
|
||||
@@ -219,7 +219,7 @@ class UserTest extends TestCase
|
||||
|
||||
public function testPasswordRequestedAt(): void
|
||||
{
|
||||
$date = new \DateTime('-60 minutes');
|
||||
$date = new \DateTimeImmutable('-60 minutes');
|
||||
$sut = new User();
|
||||
self::assertFalse($sut->isPasswordRequestNonExpired(3599));
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class WorkingTimeTest extends TestCase
|
||||
{
|
||||
$user = new User();
|
||||
$user->setUsername('bar');
|
||||
$date = new \DateTime();
|
||||
$date = new \DateTimeImmutable();
|
||||
$sut = new WorkingTime($user, $date);
|
||||
|
||||
self::assertSame($user, $sut->getUser());
|
||||
@@ -36,7 +36,7 @@ class WorkingTimeTest extends TestCase
|
||||
self::assertNull($sut->getApprovedBy());
|
||||
self::assertFalse($sut->isApproved());
|
||||
|
||||
$approvedAt = new \DateTime('2023-01-01 12:00:00', new \DateTimeZone('Europe/Vienna'));
|
||||
$approvedAt = new \DateTimeImmutable('2023-01-01 12:00:00', new \DateTimeZone('Europe/Vienna'));
|
||||
$approvedBy = new User();
|
||||
$approvedBy->setUsername('foo');
|
||||
|
||||
|
||||
@@ -1922,16 +1922,6 @@ parameters:
|
||||
count: 1
|
||||
path: Configuration/SamlConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:getDefaultLoaderSettings\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:getDefaultSettings\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:getSut\\(\\) has parameter \\$loaderSettings with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -1942,61 +1932,6 @@ parameters:
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testCalendarWithLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testCalendarWithoutLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testDefaultWithLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testDefaultWithMixedConfigs\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testDefaultWithoutLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testFormDefaultWithLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testFormDefaultWithoutLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testOffsetUnsetThrowsException\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testTimesheetWithLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testTimesheetWithoutLoader\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Configuration\\\\SystemConfigurationTest\\:\\:testUnknownConfigs\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\ConsoleApplicationTest\\:\\:testVersion\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
|
||||
Reference in New Issue
Block a user