use enabled_locales logic to handle locales (#5017)

* allow to skip locales (here: catalan)
* use enabled_locales and replace app_locales with kimai_locales
* added test to call all reports once for super_admin
This commit is contained in:
Kevin Papst
2024-08-11 17:43:20 +02:00
committed by GitHub
parent 62047c7c01
commit 9e3d243b4b
13 changed files with 69 additions and 29 deletions

View File

@@ -81,7 +81,16 @@ class PermissionControllerTest extends ControllerBaseTest
public function testDeleteRoleIsSecured(): void
{
$this->assertUrlIsSecured('/admin/permissions/roles/1/delete/sdfsdfsdfsd');
$client = self::createClient();
$role = new Role();
$role->setName('TEST_ROLE');
$em = $this->getEntityManager();
$em->persist($role);
$em->flush();
$this->assertRequestIsSecured($client, '/admin/permissions/roles/' . $role->getId() . '/delete/sdfsdfsdfsd');
}
public function testDeleteRoleIsSecuredForRole(): void
@@ -150,7 +159,16 @@ class PermissionControllerTest extends ControllerBaseTest
public function testSavePermissionIsSecured(): void
{
$this->assertUrlIsSecured('/admin/permissions/roles/1/view_user/1/asdfasdf', 'POST');
$client = self::createClient();
$role = new Role();
$role->setName('TEST_ROLE');
$em = $this->getEntityManager();
$em->persist($role);
$em->flush();
$this->assertRequestIsSecured($client, '/admin/permissions/roles/' . $role->getId() . '/view_user/1/asdfasdf', 'POST');
}
public function testSavePermissionIsSecuredForRole(): void

View File

@@ -18,7 +18,7 @@ class QuickEntryControllerTest extends ControllerBaseTest
{
public function testIsSecure(): void
{
$this->assertUrlIsSecured('/quick_entry');
$this->assertUrlIsSecured('/quick_entry/');
}
public function testIndexAction(): void

View File

@@ -18,7 +18,7 @@ class ReportingControllerTest extends ControllerBaseTest
{
public function testIsSecure(): void
{
$this->assertUrlIsSecured('/reporting');
$this->assertUrlIsSecured('/reporting/');
}
public function testOverviewPage(): void
@@ -29,6 +29,24 @@ class ReportingControllerTest extends ControllerBaseTest
$this->assertCount(11, $nodes);
}
public function testAllReports(): void
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->request($client, '/reporting/');
$nodes = $client->getCrawler()->filter('section.content div.row-cards a.card-link');
$this->assertCount(11, $nodes);
foreach ($nodes as $node) {
self::assertNotNull($node->attributes);
$link = $node->attributes->getNamedItem('href');
self::assertNotNull($link);
$url = $link->nodeValue;
self::assertNotNull($url);
self::assertNotEmpty($url);
self::assertStringStartsWith('/en/reporting/', $url);
$this->request($client, $url);
}
}
public function testOverviewPageAsUser(): void
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);