update to Symfony 4.4 (#1275)

This commit is contained in:
Kevin Papst
2020-02-04 15:29:26 +01:00
committed by GitHub
parent 375691365e
commit 75dcae6fbe
53 changed files with 1046 additions and 1019 deletions

View File

@@ -43,7 +43,7 @@ class ProjectControllerTest extends ControllerBaseTest
public function testIndexActionWithSearchTermQuery()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$fixture = new ProjectFixtures();
$fixture->setAmount(5);
$fixture->setCallback(function (Project $project) {
@@ -52,7 +52,7 @@ class ProjectControllerTest extends ControllerBaseTest
$project->setMetaField((new ProjectMeta())->setName('location')->setValue('homeoffice'));
$project->setMetaField((new ProjectMeta())->setName('feature')->setValue('timetracking'));
});
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/');
@@ -82,13 +82,13 @@ class ProjectControllerTest extends ControllerBaseTest
$fixture->setAmount(10);
$fixture->setProjects([$project]);
$fixture->setUser($this->getUserByRole($em, User::ROLE_ADMIN));
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$project = $em->getRepository(Project::class)->find(1);
$fixture = new ActivityFixtures();
$fixture->setAmount(6); // to trigger a second page
$fixture->setProjects([$project]);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/details');
@@ -180,14 +180,14 @@ class ProjectControllerTest extends ControllerBaseTest
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/details');
$node = $client->getCrawler()->filter('div.box#team_listing_box .box-body');
self::assertStringContainsString('Visible to everyone, as no team was assigned yet.', $node->text());
self::assertStringContainsString('Visible to everyone, as no team was assigned yet.', $node->text(null, true));
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->request($client, '/admin/project/1/create_team');
$this->assertIsRedirect($client, $this->createUrl('/admin/project/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#team_listing_box .box-body');
self::assertStringContainsString('Only visible to the following teams and all admins.', $node->text());
self::assertStringContainsString('Only visible to the following teams and all admins.', $node->text(null, true));
$node = $client->getCrawler()->filter('div.box#team_listing_box .box-body table tbody tr');
self::assertEquals(1, $node->count());
}
@@ -204,7 +204,7 @@ class ProjectControllerTest extends ControllerBaseTest
$fixture = new ActivityFixtures();
$fixture->setAmount(9); // to trigger a second page (every third activity is hidden)
$fixture->setProjects([$project]);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/activities/1');
@@ -249,10 +249,9 @@ class ProjectControllerTest extends ControllerBaseTest
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$fixture = new CustomerFixtures();
$fixture->setAmount(10);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$this->assertAccessIsGranted($client, '/admin/project/create');
$form = $client->getCrawler()->filter('form[name=project_edit_form]')->form();
@@ -308,7 +307,7 @@ class ProjectControllerTest extends ControllerBaseTest
$fixture = new TeamFixtures();
$fixture->setAmount(2);
$fixture->setAddCustomer(false);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$this->assertAccessIsGranted($client, '/admin/project/1/permissions');
$form = $client->getCrawler()->filter('form[name=project_team_permission_form]')->form();
@@ -333,10 +332,9 @@ class ProjectControllerTest extends ControllerBaseTest
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$fixture = new ProjectFixtures();
$fixture->setAmount(1);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$this->request($client, '/admin/project/2/edit');
$this->assertTrue($client->getResponse()->isSuccessful());
@@ -363,7 +361,7 @@ class ProjectControllerTest extends ControllerBaseTest
$fixture = new TimesheetFixtures();
$fixture->setUser($this->getUserByRole($em, User::ROLE_USER));
$fixture->setAmount(10);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$timesheets = $em->getRepository(Timesheet::class)->findAll();
$this->assertEquals(10, count($timesheets));
@@ -402,10 +400,10 @@ class ProjectControllerTest extends ControllerBaseTest
$fixture = new TimesheetFixtures();
$fixture->setUser($this->getUserByRole($em, User::ROLE_USER));
$fixture->setAmount(10);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$fixture = new ProjectFixtures();
$fixture->setAmount(1)->setIsVisible(true);
$this->importFixture($em, $fixture);
$this->importFixture($client, $fixture);
$timesheets = $em->getRepository(Timesheet::class)->findAll();
$this->assertEquals(10, count($timesheets));