Release 2.0.18 (#4003)

* prevent too long values for user preferences
* add chart value 0 to y-axis if last value > 0, to always display the zero line (project details)
* add user-preferences to invoice hydrator
* DateTime vs DateTimeInterface
* simplify permission config
* fix query for teamleads limiting to only selected teams not possible
This commit is contained in:
Kevin Papst
2023-05-08 17:11:55 +02:00
committed by GitHub
parent d8f72b8b88
commit 1099e76244
74 changed files with 627 additions and 621 deletions

View File

@@ -69,6 +69,8 @@ class InvoiceItemDefaultHydratorTest extends TestCase
'entry.user_alias',
'entry.user_display',
'entry.user_title',
'entry.user_preference.foo',
'entry.user_preference.mad',
'entry.activity',
'entry.activity_id',
'entry.activity.meta.foo-activity',

View File

@@ -276,6 +276,8 @@ class DebugRendererTest extends TestCase
'entry.user_display',
'entry.user_alias',
'entry.user_title',
'entry.user_preference.foo',
'entry.user_preference.mad',
'entry.activity',
'entry.activity_id',
'entry.activity.meta.foo-activity',

View File

@@ -133,17 +133,21 @@ trait RendererTestTrait
$activity2->method('getMetaFields')->willReturn(new ArrayCollection([$aMeta2]));
$activity2->method('getVisibleMetaFields')->willReturn([$aMeta2]);
$userMethods = ['getId', 'getPreferenceValue', 'getUsername', 'getUserIdentifier'];
$pref1 = new UserPreference('foo', 'bar');
$pref2 = new UserPreference('mad', 123.45);
$userMethods = ['getId', 'getPreferenceValue', 'getVisiblePreferences', 'getUsername', 'getUserIdentifier'];
$user1 = $this->getMockBuilder(User::class)->onlyMethods($userMethods)->disableOriginalConstructor()->getMock();
$user1->method('getId')->willReturn(1);
$user1->method('getPreferenceValue')->willReturn('50');
$user1->method('getUsername')->willReturn('foo-bar');
$user1->method('getUserIdentifier')->willReturn('foo-bar');
$user1->method('getVisiblePreferences')->willReturn([$pref1, $pref2]);
$user2 = $this->getMockBuilder(User::class)->onlyMethods($userMethods)->disableOriginalConstructor()->getMock();
$user2 = $this->createMock(User::class);
$user2->method('getId')->willReturn(2);
$user2->method('getUsername')->willReturn('hello-world');
$user2->method('getUserIdentifier')->willReturn('hello-world');
$user2->method('getVisiblePreferences')->willReturn([$pref1, $pref2]);
$timesheet = new Timesheet();
$timesheet
@@ -204,6 +208,8 @@ trait RendererTestTrait
$userKevin = new User();
$userKevin->setUserIdentifier('kevin');
$userKevin->addPreference($pref1);
$userKevin->addPreference($pref2);
$timesheet5 = new Timesheet();
$timesheet5
@@ -292,11 +298,14 @@ trait RendererTestTrait
$activity->setProject($project);
$activity->setMetaField((new ActivityMeta())->setName('foo-activity')->setValue('bar-activity')->setIsVisible(true));
$pref1 = new UserPreference('foo', 'bar');
$pref2 = new UserPreference('mad', 123.45);
$user1 = $this->createMock(User::class);
$user1->method('getId')->willReturn(1);
$user1->method('getPreferenceValue')->willReturn('50');
$user1->method('getUsername')->willReturn('foo-bar');
$user1->method('getUserIdentifier')->willReturn('foo-bar');
$user1->method('getVisiblePreferences')->willReturn([$pref1, $pref2]);
$timesheet = new Timesheet();
$timesheet

View File

@@ -13,6 +13,7 @@ use App\Entity\User;
use App\Saml\SamlToken;
use App\Saml\Security\SamlAuthenticationSuccessHandler;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\HttpUtils;
@@ -27,6 +28,7 @@ class SamlAuthenticationSuccessHandlerTest extends TestCase
$handler = new SamlAuthenticationSuccessHandler($httpUtils, ['always_use_default_target_path' => true]);
$defaultTargetPath = $httpUtils->generateUri($this->getRequest('/sso/login'), $this->getOption($handler, 'default_target_path', '/'));
$response = $handler->onAuthenticationSuccess($this->getRequest('/login', 'http://localhost/relayed'), $this->getSamlToken());
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertTrue($response->isRedirect($defaultTargetPath));
}
@@ -34,6 +36,7 @@ class SamlAuthenticationSuccessHandlerTest extends TestCase
{
$handler = new SamlAuthenticationSuccessHandler(new HttpUtils($this->getUrlGenerator()), ['always_use_default_target_path' => false]);
$response = $handler->onAuthenticationSuccess($this->getRequest('/sso/login', 'http://localhost/relayed'), $this->getSamlToken());
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertTrue($response->isRedirect('http://localhost/relayed'));
}
@@ -43,6 +46,7 @@ class SamlAuthenticationSuccessHandlerTest extends TestCase
$handler = new SamlAuthenticationSuccessHandler($httpUtils, ['always_use_default_target_path' => false]);
$defaultTargetPath = $httpUtils->generateUri($this->getRequest('/sso/login'), $this->getOption($handler, 'default_target_path', '/'));
$response = $handler->onAuthenticationSuccess($this->getRequest(), $this->getSamlToken());
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertTrue($response->isRedirect($defaultTargetPath));
}
@@ -52,6 +56,7 @@ class SamlAuthenticationSuccessHandlerTest extends TestCase
$handler = new SamlAuthenticationSuccessHandler($httpUtils, ['always_use_default_target_path' => false]);
$loginPath = $httpUtils->generateUri($this->getRequest('/sso/login'), $this->getOption($handler, 'login_path', '/login'));
$response = $handler->onAuthenticationSuccess($this->getRequest($loginPath), $this->getSamlToken());
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertTrue(!$response->isRedirect($loginPath));
}