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

@@ -37,6 +37,7 @@ class UserControllerTest extends ControllerBaseTest
$this->assertPageActions($client, [
'search search-toggle visible-xs-inline' => '#',
'visibility' => '#',
'download toolbar-action' => $this->createUrl('/admin/user/export'),
'permissions' => $this->createUrl('/admin/permissions'),
'create' => $this->createUrl('/admin/user/create'),
'help' => 'https://www.kimai.org/documentation/users.html'
@@ -64,6 +65,38 @@ class UserControllerTest extends ControllerBaseTest
$this->assertDataTableRowCount($client, 'datatable_user_admin', 1);
}
public function testExportIsSecureForRole()
{
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/user/export');
}
public function testExportAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/user/export');
$this->assertExcelExportResponse($client, 'kimai-users_');
}
public function testExportActionWithSearchTermQuery()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->request($client, '/admin/user/');
$this->assertTrue($client->getResponse()->isSuccessful());
$form = $client->getCrawler()->filter('form.header-search')->form();
$form->getFormNode()->setAttribute('action', $this->createUrl('/admin/user/export'));
$client->submit($form, [
'searchTerm' => 'hourly_rate:35 tony',
'role' => 'ROLE_TEAMLEAD',
'visibility' => 1,
'pageSize' => 50,
'page' => 1,
]);
$this->assertExcelExportResponse($client, 'kimai-users_');
}
public function testCreateAction()
{
$username = '亚历山德拉';