Drop SQLite support (#2405)

This commit is contained in:
Kevin Papst
2021-03-08 16:06:22 +01:00
committed by GitHub
parent 70f7f35009
commit 30ac5e4c24
78 changed files with 1165 additions and 1596 deletions

View File

@@ -13,6 +13,7 @@ use App\Entity\Activity;
use App\Entity\ActivityMeta;
use App\Entity\ActivityRate;
use App\Entity\Project;
use App\Entity\ProjectComment;
use App\Entity\ProjectMeta;
use App\Entity\ProjectRate;
use App\Entity\Team;
@@ -213,7 +214,7 @@ class ProjectControllerTest extends ControllerBaseTest
$em->persist($rate);
$this->request($client, '/admin/project/1/duplicate');
$this->assertIsRedirect($client, $this->createUrl('/admin/project/2/details'));
$this->assertIsRedirect($client, '/details');
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#project_rates_box');
self::assertEquals(1, $node->count());
@@ -253,9 +254,12 @@ class ProjectControllerTest extends ControllerBaseTest
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-text');
self::assertStringContainsString('Foo bar blub', $node->html());
$node = $client->getCrawler()->filter('div.box#comments_box .box-body a.confirmation-link');
self::assertEquals($this->createUrl('/admin/project/1/comment_delete'), $node->attr('href'));
$this->request($client, '/admin/project/1/comment_delete');
$comments = $this->getEntityManager()->getRepository(ProjectComment::class)->findAll();
$id = $comments[0]->getId();
self::assertEquals($this->createUrl('/admin/project/' . $id . '/comment_delete'), $node->attr('href'));
$this->request($client, '/admin/project/' . $id . '/comment_delete');
$this->assertIsRedirect($client, $this->createUrl('/admin/project/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#comments_box .box-body');
@@ -279,12 +283,15 @@ class ProjectControllerTest extends ControllerBaseTest
$node = $client->getCrawler()->filter('div.box#comments_box .box-body a.btn.active');
self::assertEquals(0, $node->count());
$this->request($client, '/admin/project/1/comment_pin');
$comments = $this->getEntityManager()->getRepository(ProjectComment::class)->findAll();
$id = $comments[0]->getId();
$this->request($client, '/admin/project/' . $id . '/comment_pin');
$this->assertIsRedirect($client, $this->createUrl('/admin/project/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#comments_box .box-body a.btn.active');
self::assertEquals(1, $node->count());
self::assertEquals($this->createUrl('/admin/project/1/comment_pin'), $node->attr('href'));
self::assertEquals($this->createUrl('/admin/project/' . $id . '/comment_pin'), $node->attr('href'));
}
public function testCreateDefaultTeamAction()
@@ -346,7 +353,7 @@ class ProjectControllerTest extends ControllerBaseTest
'customer' => 1,
]
]);
$this->assertIsRedirect($client, $this->createUrl('/admin/project/2/details'));
$this->assertIsRedirect($client, '/details');
$client->followRedirect();
$this->assertHasFlashSuccess($client);
}
@@ -418,22 +425,24 @@ class ProjectControllerTest extends ControllerBaseTest
$fixture = new ProjectFixtures();
$fixture->setAmount(1);
$this->importFixture($fixture);
/** @var Project[] $projects */
$projects = $this->importFixture($fixture);
$id = $projects[0]->getId();
$this->request($client, '/admin/project/2/edit');
$this->request($client, '/admin/project/' . $id . '/edit');
$this->assertTrue($client->getResponse()->isSuccessful());
$this->request($client, '/admin/project/2/delete');
$this->request($client, '/admin/project/' . $id . '/delete');
$this->assertTrue($client->getResponse()->isSuccessful());
$form = $client->getCrawler()->filter('form[name=form]')->form();
$this->assertStringEndsWith($this->createUrl('/admin/project/2/delete'), $form->getUri());
$this->assertStringEndsWith($this->createUrl('/admin/project/' . $id . '/delete'), $form->getUri());
$client->submit($form);
$client->followRedirect();
$this->assertHasDataTable($client);
$this->assertHasFlashSuccess($client);
$this->request($client, '/admin/project/2/edit');
$this->request($client, '/admin/project/' . $id . '/edit');
$this->assertFalse($client->getResponse()->isSuccessful());
}
@@ -467,10 +476,9 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertHasFlashDeleteSuccess($client);
$this->assertHasNoEntriesWithFilter($client);
// SQLIte does not necessarly support onCascade delete, so these timesheet will stay after deletion
// $em->clear();
// $timesheets = $em->getRepository(Timesheet::class)->findAll();
// $this->assertEquals(0, count($timesheets));
$em->clear();
$timesheets = $em->getRepository(Timesheet::class)->findAll();
$this->assertEquals(0, \count($timesheets));
$this->request($client, '/admin/project/1/edit');
$this->assertFalse($client->getResponse()->isSuccessful());
@@ -487,7 +495,8 @@ class ProjectControllerTest extends ControllerBaseTest
$this->importFixture($fixture);
$fixture = new ProjectFixtures();
$fixture->setAmount(1)->setIsVisible(true);
$this->importFixture($fixture);
$projects = $this->importFixture($fixture);
$id = $projects[0]->getId();
$timesheets = $em->getRepository(Timesheet::class)->findAll();
$this->assertEquals(10, \count($timesheets));
@@ -504,7 +513,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertStringEndsWith($this->createUrl('/admin/project/1/delete'), $form->getUri());
$client->submit($form, [
'form' => [
'project' => 2
'project' => $id
]
]);
@@ -518,7 +527,7 @@ class ProjectControllerTest extends ControllerBaseTest
/** @var Timesheet $entry */
foreach ($timesheets as $entry) {
$this->assertEquals(2, $entry->getProject()->getId());
$this->assertEquals($id, $entry->getProject()->getId());
}
$this->request($client, '/admin/project/1/edit');