improve permissison handling in invoice screen (#2965)

This commit is contained in:
Kevin Papst
2021-11-21 16:41:03 +01:00
committed by GitHub
parent 76e09447c8
commit ff9acab0fc
15 changed files with 183 additions and 124 deletions

View File

@@ -207,7 +207,7 @@ class InvoiceControllerTest extends ControllerBaseTest
}
}
public function testPrintAction()
public function testPreviewAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
@@ -233,9 +233,11 @@ class InvoiceControllerTest extends ControllerBaseTest
$params = [
'daterange' => $dateRange,
'projects' => [1],
'template' => $id,
'customers[]' => 1
];
$action = '/invoice/preview/1/' . $id . '?' . http_build_query($params);
$action = '/invoice/preview/1?' . http_build_query($params);
$this->request($client, $action);
$this->assertTrue($client->getResponse()->isSuccessful());
$node = $client->getCrawler()->filter('body');
@@ -243,7 +245,7 @@ class InvoiceControllerTest extends ControllerBaseTest
$this->assertEquals('invoice_print', $node->getIterator()[0]->getAttribute('class'));
}
public function testCreateActionAsAdminWithDownloadAndStatusChangeAndDelete()
public function testCreateActionAsAdminWithDownloadAndStatusChange()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -352,12 +354,6 @@ class InvoiceControllerTest extends ControllerBaseTest
$this->assertIsRedirect($client, '/invoice/show');
$client->followRedirect();
$this->assertTrue($client->getResponse()->isSuccessful());
// this does not delete the invoice, because the token is wrong
$this->request($client, '/invoice/delete/' . $id . '/fghfkjhgkjhg');
$this->assertIsRedirect($client, '/invoice/show');
$client->followRedirect();
$this->assertTrue($client->getResponse()->isSuccessful());
}
public function testEditTemplateAction()