replaced delete confirm dialog with modal (#638)

This commit is contained in:
Kevin Papst
2019-03-12 23:24:22 +01:00
committed by GitHub
parent 46655ad462
commit f4d53e9006
43 changed files with 303 additions and 109 deletions

View File

@@ -14,7 +14,6 @@ use App\Entity\User;
use App\Form\Type\DateRangeType;
use App\Tests\Controller\ControllerBaseTest;
use App\Tests\DataFixtures\TimesheetFixtures;
use Gedmo\Loggable\Entity\LogEntry;
/**
* @coversDefaultClass \App\Controller\TimesheetTeamController
@@ -147,21 +146,6 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
$this->assertNull($timesheet->getFixedRate());
}
public function testDeleteActionIsNotAllowedForTeamlead()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$fixture = new TimesheetFixtures();
$fixture->setAmount(10);
$fixture->setUser($this->getUserByRole($em, User::ROLE_USER));
$fixture->setStartDate('2017-05-01');
$this->importFixture($em, $fixture);
$this->request($client, '/team/timesheet/1/delete');
$this->assertFalse($client->getResponse()->isSuccessful());
}
public function testDeleteAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -177,10 +161,16 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
$this->assertTrue($client->getResponse()->isSuccessful());
$this->request($client, '/team/timesheet/1/delete');
$this->assertIsRedirect($client, $this->createUrl('/team/timesheet/page/1'));
$this->assertTrue($client->getResponse()->isSuccessful());
$form = $client->getCrawler()->filter('form[name=form]')->form();
$this->assertStringEndsWith($this->createUrl('/team/timesheet/1/delete'), $form->getUri());
$client->submit($form);
$client->followRedirect();
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertHasFlashSuccess($client);
$this->assertHasFlashDeleteSuccess($client);
$this->assertHasDataTable($client);
$this->request($client, '/team/timesheet/1/edit');
$this->assertFalse($client->getResponse()->isSuccessful());