export filtered timesheets without additional search form (#5234)

This commit is contained in:
Kevin Papst
2024-12-15 18:38:30 +01:00
committed by GitHub
parent 17a815e5a9
commit 21c031f2c8
33 changed files with 98 additions and 306 deletions

View File

@@ -43,9 +43,12 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
$this->assertHasNoEntriesWithFilter($client);
$this->assertPageActions($client, [
'download modal-ajax-form' => $this->createUrl('/team/timesheet/export/'),
'create create-ts modal-ajax-form' => $this->createUrl('/team/timesheet/create'),
'multi-user create-ts-mu modal-ajax-form' => $this->createUrl('/team/timesheet/create_mu'),
'dropdown-item action-csv toolbar-action' => $this->createUrl('/team/timesheet/export/csv'),
'dropdown-item action-print toolbar-action' => $this->createUrl('/team/timesheet/export/print'),
'dropdown-item action-pdf toolbar-action' => $this->createUrl('/team/timesheet/export/pdf'),
'dropdown-item action-xlsx toolbar-action' => $this->createUrl('/team/timesheet/export/xlsx'),
]);
}
@@ -136,12 +139,14 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
$fixture->setStartDate(new \DateTime('-10 days'));
$this->importFixture($fixture);
$this->request($client, '/team/timesheet/export/');
$this->request($client, '/team/timesheet/');
$this->assertTrue($client->getResponse()->isSuccessful());
$dateRange = $this->formatDateRange(new \DateTime('-10 days'), new \DateTime());
$client->submitForm('export-btn-print', [
$form = $client->getCrawler()->filter('form.searchform')->form();
$form->getNode()->setAttribute('action', $this->createUrl('/team/timesheet/export/print'));
$client->submit($form, [
'state' => 1,
'daterange' => $dateRange,
'customers' => [],
@@ -158,6 +163,13 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
$this->assertEquals(10, \count($result));
}
public function testExporterNotFoundAction(): void
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->request($client, '/team/timesheet/export/notfound');
$this->assertRouteNotFound($client);
}
public function testCreateAction(): void
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);