added annotation based exporter (#1831)

* added user exporter
* added project exporter
* added customer exporter
* added activity exporter
This commit is contained in:
Kevin Papst
2020-07-21 03:37:51 +02:00
committed by GitHub
parent 93a23f3fa3
commit aee063bb3c
79 changed files with 2980 additions and 215 deletions

View File

@@ -73,6 +73,48 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertDataTableRowCount($client, 'datatable_activity_admin', 5);
}
public function testExportIsSecureForRole()
{
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/activity/export');
}
public function testExportAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/activity/export');
$this->assertExcelExportResponse($client, 'kimai-activities_');
}
public function testExportActionWithSearchTermQuery()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$fixture = new ActivityFixtures();
$fixture->setAmount(5);
$fixture->setCallback(function (Activity $activity) {
$activity->setVisible(true);
$activity->setComment('I am a foobar with tralalalala some more content');
$activity->setMetaField((new ActivityMeta())->setName('location')->setValue('homeoffice'));
$activity->setMetaField((new ActivityMeta())->setName('feature')->setValue('timetracking'));
});
$this->importFixture($fixture);
$this->assertAccessIsGranted($client, '/admin/activity/');
$form = $client->getCrawler()->filter('form.header-search')->form();
$form->getFormNode()->setAttribute('action', $this->createUrl('/admin/activity/export'));
$client->submit($form, [
'searchTerm' => 'feature:timetracking foo',
'visibility' => 1,
'pageSize' => 50,
'customers' => [1],
'projects' => [1],
'page' => 1,
]);
$this->assertExcelExportResponse($client, 'kimai-activities_');
}
public function testDetailsAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);