Drop SQLite support (#2405)
This commit is contained in:
@@ -180,7 +180,11 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
$client->followRedirect();
|
||||
$this->assertHasDataTable($client);
|
||||
|
||||
$this->request($client, '/admin/activity/2/edit');
|
||||
$activities = $this->getEntityManager()->getRepository(Activity::class)->findAll();
|
||||
$activity = array_pop($activities);
|
||||
$id = $activity->getId();
|
||||
|
||||
$this->request($client, '/admin/activity/' . $id . '/edit');
|
||||
$editForm = $client->getCrawler()->filter('form[name=activity_edit_form]')->form();
|
||||
$this->assertEquals('An AcTiVitY Name', $editForm->get('activity_edit_form[name]')->getValue());
|
||||
// make sure customer and project are pre-selected for none global activities
|
||||
@@ -240,15 +244,16 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
/** @var Activity $activity */
|
||||
$activity = $em->getRepository(Activity::class)->find(1);
|
||||
$activity = $em->getRepository(Activity::class)->findAll()[0];
|
||||
self::assertEquals(0, $activity->getTeams()->count());
|
||||
$id = $activity->getId();
|
||||
|
||||
$fixture = new TeamFixtures();
|
||||
$fixture->setAmount(2);
|
||||
$fixture->setAddCustomer(false);
|
||||
$this->importFixture($fixture);
|
||||
|
||||
$this->assertAccessIsGranted($client, '/admin/activity/1/permissions');
|
||||
$this->assertAccessIsGranted($client, '/admin/activity/' . $id . '/permissions');
|
||||
$form = $client->getCrawler()->filter('form[name=activity_team_permission_form]')->form();
|
||||
/** @var ChoiceFormField $team1 */
|
||||
$team1 = $form->get('activity_team_permission_form[teams][0]');
|
||||
@@ -263,7 +268,7 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
$this->assertHasDataTable($client);
|
||||
|
||||
/** @var Activity $activity */
|
||||
$activity = $em->getRepository(Activity::class)->find(1);
|
||||
$activity = $em->getRepository(Activity::class)->find($id);
|
||||
self::assertEquals(2, $activity->getTeams()->count());
|
||||
}
|
||||
|
||||
@@ -342,10 +347,9 @@ class ActivityControllerTest 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/activity/1/edit');
|
||||
$this->assertFalse($client->getResponse()->isSuccessful());
|
||||
@@ -364,7 +368,9 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new ActivityFixtures();
|
||||
$fixture->setAmount(1)->setIsGlobal(true)->setIsVisible(true);
|
||||
$this->importFixture($fixture);
|
||||
$activities = $this->importFixture($fixture);
|
||||
$activity = $activities[0];
|
||||
$id = $activity->getId();
|
||||
|
||||
$timesheets = $em->getRepository(Timesheet::class)->findAll();
|
||||
$this->assertEquals(10, \count($timesheets));
|
||||
@@ -381,7 +387,7 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
$this->assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri());
|
||||
$client->submit($form, [
|
||||
'form' => [
|
||||
'activity' => 2
|
||||
'activity' => $id
|
||||
]
|
||||
]);
|
||||
|
||||
@@ -395,7 +401,7 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
|
||||
/** @var Timesheet $entry */
|
||||
foreach ($timesheets as $entry) {
|
||||
$this->assertEquals(2, $entry->getActivity()->getId());
|
||||
$this->assertEquals($id, $entry->getActivity()->getId());
|
||||
}
|
||||
|
||||
$this->request($client, '/admin/activity/1/edit');
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\CustomerComment;
|
||||
use App\Entity\CustomerMeta;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
@@ -176,9 +177,12 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-msg');
|
||||
self::assertStringContainsString('Blah foo bar', $node->html());
|
||||
$node = $client->getCrawler()->filter('div.box#comments_box .box-body a.confirmation-link');
|
||||
self::assertEquals($this->createUrl('/admin/customer/1/comment_delete'), $node->attr('href'));
|
||||
self::assertStringEndsWith('/comment_delete', $node->attr('href'));
|
||||
|
||||
$this->request($client, '/admin/customer/1/comment_delete');
|
||||
$comments = $this->getEntityManager()->getRepository(CustomerComment::class)->findAll();
|
||||
$id = $comments[0]->getId();
|
||||
|
||||
$this->request($client, '/admin/customer/' . $id . '/comment_delete');
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/1/details'));
|
||||
$client->followRedirect();
|
||||
$node = $client->getCrawler()->filter('div.box#comments_box .box-body');
|
||||
@@ -202,12 +206,15 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-text a.btn.active');
|
||||
self::assertEquals(0, $node->count());
|
||||
|
||||
$this->request($client, '/admin/customer/1/comment_pin');
|
||||
$comments = $this->getEntityManager()->getRepository(CustomerComment::class)->findAll();
|
||||
$id = $comments[0]->getId();
|
||||
|
||||
$this->request($client, '/admin/customer/' . $id . '/comment_pin');
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/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/customer/1/comment_pin'), $node->attr('href'));
|
||||
self::assertEquals($this->createUrl('/admin/customer/' . $id . '/comment_pin'), $node->attr('href'));
|
||||
}
|
||||
|
||||
public function testCreateDefaultTeamAction()
|
||||
@@ -278,7 +285,7 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
'name' => 'Test Customer',
|
||||
]
|
||||
]);
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/2/details'));
|
||||
$this->assertIsRedirect($client, '/details');
|
||||
$client->followRedirect();
|
||||
$this->assertHasFlashSuccess($client);
|
||||
}
|
||||
@@ -352,22 +359,24 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
|
||||
$fixture = new CustomerFixtures();
|
||||
$fixture->setAmount(1);
|
||||
$this->importFixture($fixture);
|
||||
$customers = $this->importFixture($fixture);
|
||||
$customer = $customers[0];
|
||||
$id = $customer->getId();
|
||||
|
||||
$this->request($client, '/admin/customer/2/edit');
|
||||
$this->request($client, '/admin/customer/' . $id . '/edit');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$this->request($client, '/admin/customer/2/delete');
|
||||
$this->request($client, '/admin/customer/' . $id . '/delete');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$form = $client->getCrawler()->filter('form[name=form]')->form();
|
||||
$this->assertStringEndsWith($this->createUrl('/admin/customer/2/delete'), $form->getUri());
|
||||
$this->assertStringEndsWith($this->createUrl('/admin/customer/' . $id . '/delete'), $form->getUri());
|
||||
$client->submit($form);
|
||||
|
||||
$client->followRedirect();
|
||||
$this->assertHasDataTable($client);
|
||||
$this->assertHasFlashSuccess($client);
|
||||
|
||||
$this->request($client, '/admin/customer/2/edit');
|
||||
$this->request($client, '/admin/customer/' . $id . '/edit');
|
||||
$this->assertFalse($client->getResponse()->isSuccessful());
|
||||
}
|
||||
|
||||
@@ -401,10 +410,9 @@ class CustomerControllerTest 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/customer/1/edit');
|
||||
$this->assertFalse($client->getResponse()->isSuccessful());
|
||||
@@ -421,7 +429,9 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new CustomerFixtures();
|
||||
$fixture->setAmount(1)->setIsVisible(true);
|
||||
$this->importFixture($fixture);
|
||||
$customers = $this->importFixture($fixture);
|
||||
$customer = $customers[0];
|
||||
$id = $customer->getId();
|
||||
|
||||
$timesheets = $em->getRepository(Timesheet::class)->findAll();
|
||||
$this->assertEquals(10, \count($timesheets));
|
||||
@@ -438,7 +448,7 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
$this->assertStringEndsWith($this->createUrl('/admin/customer/1/delete'), $form->getUri());
|
||||
$client->submit($form, [
|
||||
'form' => [
|
||||
'customer' => 2
|
||||
'customer' => $id
|
||||
]
|
||||
]);
|
||||
|
||||
@@ -452,7 +462,7 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
|
||||
/** @var Timesheet $entry */
|
||||
foreach ($timesheets as $entry) {
|
||||
$this->assertEquals(2, $entry->getProject()->getCustomer()->getId());
|
||||
$this->assertEquals($id, $entry->getProject()->getCustomer()->getId());
|
||||
}
|
||||
|
||||
$this->request($client, '/admin/customer/1/edit');
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\Entity\Invoice;
|
||||
use App\Entity\InvoiceTemplate;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
use App\Form\Type\DateRangeType;
|
||||
use App\Tests\DataFixtures\InvoiceFixtures;
|
||||
use App\Tests\DataFixtures\InvoiceTemplateFixtures;
|
||||
use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
/**
|
||||
@@ -69,10 +69,11 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$templates = $this->importFixture($fixture);
|
||||
$id = $templates[0]->getId();
|
||||
|
||||
$this->request($client, '/invoice/?customer=1&template=1&preview=');
|
||||
$this->request($client, '/invoice/?customer=1&template=' . $id . '&preview=');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$this->assertHasNoEntriesWithFilter($client);
|
||||
@@ -82,7 +83,7 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$this->importFixture($fixture);
|
||||
|
||||
$this->request($client, '/invoice/template');
|
||||
@@ -117,15 +118,13 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
public function testCopyTemplateAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$templates = $this->importFixture($fixture);
|
||||
/** @var InvoiceTemplate $template */
|
||||
$template = $em->getRepository(InvoiceTemplate::class)->find(1);
|
||||
$template = $templates[0];
|
||||
|
||||
$this->request($client, '/invoice/template/create/1');
|
||||
$this->request($client, '/invoice/template/create/' . $template->getId());
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$form = $client->getCrawler()->filter('form[name=invoice_template_form]')->form();
|
||||
@@ -144,11 +143,10 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
public function testCreateAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$templates = $this->importFixture($fixture);
|
||||
$template = $templates[0];
|
||||
|
||||
$begin = new \DateTime('first day of this month');
|
||||
$end = new \DateTime('last day of this month');
|
||||
@@ -158,7 +156,10 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
->setAmount(20)
|
||||
->setStartDate($begin)
|
||||
;
|
||||
$this->importFixture($fixture);
|
||||
$timesheets = $this->importFixture($fixture);
|
||||
foreach ($timesheets as $timesheet) {
|
||||
$this->assertFalse($timesheet->isExported());
|
||||
}
|
||||
|
||||
$this->request($client, '/invoice/');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -170,7 +171,7 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$node->setAttribute('action', $this->createUrl('/invoice/?preview='));
|
||||
$node->setAttribute('method', 'GET');
|
||||
$client->submit($form, [
|
||||
'template' => 1,
|
||||
'template' => $template->getId(),
|
||||
'daterange' => $dateRange,
|
||||
'customer' => 1,
|
||||
]);
|
||||
@@ -188,7 +189,7 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$node->setAttribute('action', $this->createUrl('/invoice/?create='));
|
||||
$node->setAttribute('method', 'GET');
|
||||
$client->submit($form, [
|
||||
'template' => 1,
|
||||
'template' => $template->getId(),
|
||||
'daterange' => $dateRange,
|
||||
'customer' => 1,
|
||||
'projects' => [1],
|
||||
@@ -200,7 +201,10 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$this->assertEquals(1, $node->count());
|
||||
$this->assertEquals('invoice_print', $node->getIterator()[0]->getAttribute('class'));
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$em->clear();
|
||||
$timesheets = $em->getRepository(Timesheet::class)->findAll();
|
||||
$this->assertCount(20, $timesheets);
|
||||
/** @var Timesheet $timesheet */
|
||||
foreach ($timesheets as $timesheet) {
|
||||
$this->assertTrue($timesheet->isExported());
|
||||
@@ -210,11 +214,10 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
public function testPrintAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$templates = $this->importFixture($fixture);
|
||||
$id = $templates[0]->getId();
|
||||
|
||||
$begin = new \DateTime('first day of this month');
|
||||
$end = new \DateTime('last day of this month');
|
||||
@@ -236,7 +239,7 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$node->setAttribute('action', $this->createUrl('/invoice/?preview='));
|
||||
$node->setAttribute('method', 'GET');
|
||||
$client->submit($form, [
|
||||
'template' => 1,
|
||||
'template' => $id,
|
||||
'daterange' => $dateRange,
|
||||
'customer' => 1,
|
||||
]);
|
||||
@@ -254,7 +257,7 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$node->setAttribute('action', $this->createUrl('/invoice/?print='));
|
||||
$node->setAttribute('method', 'GET');
|
||||
$client->submit($form, [
|
||||
'template' => 1,
|
||||
'template' => $id,
|
||||
'daterange' => $dateRange,
|
||||
'customer' => 1,
|
||||
'projects' => [1],
|
||||
@@ -269,11 +272,10 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
public function testCreateActionAsAdminWithDownloadAndStatusChangeAndDelete()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$templates = $this->importFixture($fixture);
|
||||
$template = $templates[0];
|
||||
|
||||
$begin = new \DateTime('first day of this month');
|
||||
$end = new \DateTime('last day of this month');
|
||||
@@ -295,7 +297,7 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$node->setAttribute('action', $this->createUrl('/invoice/?preview='));
|
||||
$node->setAttribute('method', 'GET');
|
||||
$client->submit($form, [
|
||||
'template' => 1,
|
||||
'template' => $template->getId(),
|
||||
'daterange' => $dateRange,
|
||||
'customer' => 1,
|
||||
]);
|
||||
@@ -313,14 +315,17 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$node->setAttribute('action', $this->createUrl('/invoice/?create='));
|
||||
$node->setAttribute('method', 'GET');
|
||||
$client->submit($form, [
|
||||
'template' => 1,
|
||||
'template' => $template->getId(),
|
||||
'daterange' => $dateRange,
|
||||
'customer' => 1,
|
||||
'projects' => [1],
|
||||
'markAsExported' => 1,
|
||||
]);
|
||||
|
||||
$this->assertIsRedirect($client, '/invoice/show?id=1');
|
||||
$invoices = $this->getEntityManager()->getRepository(Invoice::class)->findAll();
|
||||
$id = $invoices[0]->getId();
|
||||
|
||||
$this->assertIsRedirect($client, '/invoice/show?id=' . $id);
|
||||
$client->followRedirect();
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
@@ -330,28 +335,28 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
$this->assertDataTableRowCount($client, 'datatable_invoices', 1);
|
||||
|
||||
// make sure the invoice is saved
|
||||
$this->request($client, '/invoice/download/1');
|
||||
$this->request($client, '/invoice/download/' . $id);
|
||||
$response = $client->getResponse();
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
self::assertInstanceOf(BinaryFileResponse::class, $response);
|
||||
self::assertFileExists($response->getFile());
|
||||
|
||||
$this->request($client, '/invoice/change-status/1/pending');
|
||||
$this->request($client, '/invoice/change-status/' . $id . '/pending');
|
||||
$this->assertIsRedirect($client, '/invoice/show');
|
||||
$client->followRedirect();
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$this->request($client, '/invoice/change-status/1/paid');
|
||||
$this->request($client, '/invoice/change-status/' . $id . '/paid');
|
||||
$this->assertIsRedirect($client, '/invoice/show');
|
||||
$client->followRedirect();
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$this->request($client, '/invoice/change-status/1/new');
|
||||
$this->request($client, '/invoice/change-status/' . $id . '/new');
|
||||
$this->assertIsRedirect($client, '/invoice/show');
|
||||
$client->followRedirect();
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$this->request($client, '/invoice/delete/1');
|
||||
$this->request($client, '/invoice/delete/' . $id);
|
||||
$this->assertIsRedirect($client, '/invoice/show');
|
||||
$client->followRedirect();
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -361,10 +366,11 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$template = $this->importFixture($fixture);
|
||||
$id = $template[0]->getId();
|
||||
|
||||
$this->request($client, '/invoice/template/1/edit?page=1');
|
||||
$this->request($client, '/invoice/template/' . $id . '/edit?page=1');
|
||||
$form = $client->getCrawler()->filter('form[name=invoice_template_form]')->form();
|
||||
$client->submit($form, [
|
||||
'invoice_template_form' => [
|
||||
@@ -387,26 +393,25 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$fixture = new InvoiceFixtures();
|
||||
$this->importFixture($fixture);
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$template = $this->importFixture($fixture);
|
||||
$id = $template[0]->getId();
|
||||
|
||||
$this->request($client, '/invoice/template/1/delete');
|
||||
$this->request($client, '/invoice/template/' . $id . '/delete');
|
||||
$this->assertIsRedirect($client, '/invoice/template');
|
||||
$client->followRedirect();
|
||||
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$this->assertHasFlashSuccess($client);
|
||||
|
||||
$this->assertEquals(0, $em->getRepository(InvoiceTemplate::class)->count([]));
|
||||
$this->assertEquals(0, $this->getEntityManager()->getRepository(InvoiceTemplate::class)->count([]));
|
||||
}
|
||||
|
||||
public function testUploadDocumentAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$fixture = new InvoiceFixtures();
|
||||
$fixture = new InvoiceTemplateFixtures();
|
||||
$this->importFixture($fixture);
|
||||
|
||||
$this->request($client, '/invoice/document_upload');
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use App\DataFixtures\UserFixtures;
|
||||
use App\Entity\Role;
|
||||
use App\Entity\RolePermission;
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Security\Csrf\CsrfToken;
|
||||
@@ -104,6 +105,15 @@ class PermissionControllerTest extends ControllerBaseTest
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/permissions'));
|
||||
$client->followRedirect();
|
||||
|
||||
$roles = $this->getEntityManager()->getRepository(Role::class)->findAll();
|
||||
$id = null;
|
||||
foreach ($roles as $role) {
|
||||
if ($role->getName() === 'TEST_ROLE') {
|
||||
$id = $role->getId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
self::assertStringContainsString('<th data-field="TEST_ROLE" class="alwaysVisible text-center">', $content);
|
||||
|
||||
@@ -126,7 +136,7 @@ class PermissionControllerTest extends ControllerBaseTest
|
||||
|
||||
/** @var CsrfToken $token */
|
||||
$token = static::$kernel->getContainer()->get('security.csrf.token_manager')->getToken('user_role_permissions');
|
||||
$this->request($client, '/admin/permissions/roles/1/delete/' . $token->getValue());
|
||||
$this->request($client, '/admin/permissions/roles/' . $id . '/delete/' . $token->getValue());
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/permissions'));
|
||||
$client->followRedirect();
|
||||
|
||||
@@ -166,9 +176,18 @@ class PermissionControllerTest extends ControllerBaseTest
|
||||
$rolePermissions = $em->getRepository(RolePermission::class)->findAll();
|
||||
$this->assertEquals(0, \count($rolePermissions));
|
||||
|
||||
$roles = $em->getRepository(Role::class)->findAll();
|
||||
$id = null;
|
||||
foreach ($roles as $role) {
|
||||
if ($role->getName() === 'TEST_ROLE') {
|
||||
$id = $role->getId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create the permission
|
||||
$token = static::$kernel->getContainer()->get('security.csrf.token_manager')->getToken('user_role_permissions');
|
||||
$this->request($client, '/admin/permissions/roles/1/view_user/1/' . $token->getValue(), 'POST');
|
||||
$this->request($client, '/admin/permissions/roles/' . $id . '/view_user/1/' . $token->getValue(), 'POST');
|
||||
|
||||
self::assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
@@ -182,14 +201,14 @@ class PermissionControllerTest extends ControllerBaseTest
|
||||
self::assertEquals('view_user', $permission->getPermission());
|
||||
self::assertTrue($permission->isAllowed());
|
||||
self::assertEquals('TEST_ROLE', $permission->getRole()->getName());
|
||||
self::assertEquals(1, $permission->getRole()->getId());
|
||||
self::assertEquals($id, $permission->getRole()->getId());
|
||||
|
||||
// flush the cache to prevent wrong results
|
||||
$em->clear();
|
||||
|
||||
// update the permission
|
||||
$token = static::$kernel->getContainer()->get('security.csrf.token_manager')->getToken('user_role_permissions');
|
||||
$this->request($client, '/admin/permissions/roles/1/view_user/0/' . $token->getValue(), 'POST');
|
||||
$this->request($client, '/admin/permissions/roles/' . $id . '/view_user/0/' . $token->getValue(), 'POST');
|
||||
|
||||
self::assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -12,21 +12,24 @@ namespace App\Tests\Controller;
|
||||
use App\Entity\Tag;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TagFixtures;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
class TagControllerTest extends ControllerBaseTest
|
||||
{
|
||||
protected function importTags(HttpKernelBrowser $client): void
|
||||
/**
|
||||
* @return Tag[]
|
||||
*/
|
||||
protected function importTags(): array
|
||||
{
|
||||
$tagList = ['Test', 'Administration', 'Support', '#2018-001', '#2018-002', '#2018-003', 'Development',
|
||||
'Marketing', 'First Level Support', 'Bug Fixing'];
|
||||
|
||||
$fixture = new TagFixtures();
|
||||
$fixture->setTagArray($tagList);
|
||||
$this->importFixture($fixture);
|
||||
|
||||
return $this->importFixture($fixture);
|
||||
}
|
||||
|
||||
public function testIsSecure()
|
||||
@@ -37,7 +40,7 @@ class TagControllerTest extends ControllerBaseTest
|
||||
public function testIndexAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
$this->importTags($client);
|
||||
$this->importTags();
|
||||
$this->assertAccessIsGranted($client, '/admin/tags/');
|
||||
|
||||
$this->assertHasDataTable($client);
|
||||
@@ -47,7 +50,7 @@ class TagControllerTest extends ControllerBaseTest
|
||||
public function testIndexActionWithSearchTermQuery()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
$this->importTags($client);
|
||||
$this->importTags();
|
||||
|
||||
$this->request($client, '/admin/tags/');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -76,7 +79,9 @@ class TagControllerTest extends ControllerBaseTest
|
||||
$client->followRedirect();
|
||||
$this->assertHasDataTable($client);
|
||||
|
||||
$this->request($client, '/admin/tags/1/edit');
|
||||
$id = $this->getEntityManager()->getRepository(Tag::class)->findAll()[0]->getId();
|
||||
|
||||
$this->request($client, '/admin/tags/' . $id . '/edit');
|
||||
$editForm = $client->getCrawler()->filter('form[name=tag_edit_form]')->form();
|
||||
$this->assertEquals('A tAG Name!', $editForm->get('tag_edit_form[name]')->getValue());
|
||||
}
|
||||
@@ -84,9 +89,10 @@ class TagControllerTest extends ControllerBaseTest
|
||||
public function testEditAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->importTags($client);
|
||||
$tags = $this->importTags();
|
||||
$id = $tags[0]->getId();
|
||||
|
||||
$this->assertAccessIsGranted($client, '/admin/tags/1/edit');
|
||||
$this->assertAccessIsGranted($client, '/admin/tags/' . $id . '/edit');
|
||||
$form = $client->getCrawler()->filter('form[name=tag_edit_form]')->form();
|
||||
$client->submit($form, [
|
||||
'tag_edit_form' => ['name' => 'Test 2 updated']
|
||||
@@ -94,7 +100,7 @@ class TagControllerTest extends ControllerBaseTest
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/tags/'));
|
||||
$client->followRedirect();
|
||||
$this->assertHasDataTable($client);
|
||||
$this->request($client, '/admin/tags/1/edit');
|
||||
$this->request($client, '/admin/tags/' . $id . '/edit');
|
||||
$editForm = $client->getCrawler()->filter('form[name=tag_edit_form]')->form();
|
||||
$this->assertEquals('Test 2 updated', $editForm->get('tag_edit_form[name]')->getValue());
|
||||
}
|
||||
@@ -102,7 +108,7 @@ class TagControllerTest extends ControllerBaseTest
|
||||
public function testMultiDeleteAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
$this->importTags($client);
|
||||
$this->importTags();
|
||||
|
||||
$this->assertAccessIsGranted($client, '/admin/tags/');
|
||||
|
||||
|
||||
@@ -78,16 +78,15 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertAccessIsGranted($client, '/admin/teams/create');
|
||||
$form = $client->getCrawler()->filter('form[name=team_edit_form]')->form();
|
||||
|
||||
$editForm = $client->getCrawler()->filter('form[name=team_edit_form]')->form();
|
||||
$this->assertEquals('', $editForm->get('team_edit_form[name]')->getValue());
|
||||
$this->assertEquals('5', $editForm->get('team_edit_form[teamlead]')->getValue());
|
||||
$this->assertEquals('', $form->get('team_edit_form[name]')->getValue());
|
||||
$this->assertEquals('5', $form->get('team_edit_form[teamlead]')->getValue());
|
||||
|
||||
$client->submit($form, [
|
||||
'team_edit_form' => [
|
||||
'name' => 'Test Team',
|
||||
'name' => 'Test Team' . uniqid(),
|
||||
]
|
||||
]);
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/teams/2/edit'));
|
||||
$this->assertIsRedirect($client, '/edit');
|
||||
$client->followRedirect();
|
||||
$this->assertHasFlashSuccess($client);
|
||||
$this->assertHasCustomerAndProjectPermissionBoxes($client);
|
||||
@@ -210,7 +209,7 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->request($client, '/admin/teams/1/duplicate');
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/teams/2/edit'));
|
||||
$this->assertIsRedirect($client, '/edit');
|
||||
$client->followRedirect();
|
||||
$node = $client->getCrawler()->filter('#team_edit_form_name');
|
||||
self::assertEquals(1, $node->count());
|
||||
|
||||
@@ -181,7 +181,7 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->findAll()[0];
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
$this->assertNull($timesheet->getEnd());
|
||||
$this->assertEquals('Testing is fun!', $timesheet->getDescription());
|
||||
@@ -218,7 +218,7 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->findAll()[0];
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getEnd());
|
||||
$this->assertEquals($expectedDuration, $timesheet->getDuration());
|
||||
@@ -293,7 +293,7 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->findAll()[0];
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getEnd());
|
||||
$this->assertEquals(50, $timesheet->getRate());
|
||||
@@ -327,7 +327,7 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->findAll()[0];
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getEnd());
|
||||
$this->assertEquals(50, $timesheet->getRate());
|
||||
@@ -428,7 +428,7 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->findAll()[0];
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getEnd());
|
||||
$this->assertEquals(800, $timesheet->getRate());
|
||||
@@ -450,9 +450,10 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
$fixture->setAmount(10);
|
||||
$fixture->setUser($this->getUserByRole(User::ROLE_USER));
|
||||
$fixture->setStartDate('2017-05-01');
|
||||
$this->importFixture($fixture);
|
||||
$timesheets = $this->importFixture($fixture);
|
||||
$id = $timesheets[0]->getId();
|
||||
|
||||
$this->request($client, '/timesheet/1/edit');
|
||||
$this->request($client, '/timesheet/' . $id . '/edit');
|
||||
|
||||
$response = $client->getResponse();
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
@@ -478,7 +479,7 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find($id);
|
||||
$this->assertEquals('foo-bar', $timesheet->getDescription());
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->findAll()[0];
|
||||
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
$this->assertNull($timesheet->getEnd());
|
||||
$this->assertEquals('Testing is fun!', $timesheet->getDescription());
|
||||
@@ -271,9 +271,10 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
|
||||
$fixture->setAmount(10);
|
||||
$fixture->setUser($user);
|
||||
$fixture->setStartDate('2017-05-01');
|
||||
$this->importFixture($fixture);
|
||||
$timesheets = $this->importFixture($fixture);
|
||||
$id = $timesheets[0]->getId();
|
||||
|
||||
$this->request($client, '/team/timesheet/1/edit');
|
||||
$this->request($client, '/team/timesheet/' . $id . '/edit');
|
||||
|
||||
$response = $client->getResponse();
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
@@ -300,7 +301,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
/** @var Timesheet $timesheet */
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find(1);
|
||||
$timesheet = $em->getRepository(Timesheet::class)->find($id);
|
||||
$this->assertEquals('foo-bar', $timesheet->getDescription());
|
||||
$this->assertEquals($teamlead->getId(), $timesheet->getUser()->getId());
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class UserControllerTest extends ControllerBaseTest
|
||||
|
||||
public function testCreateAction()
|
||||
{
|
||||
$username = '亚历山德拉';
|
||||
$username = '亚历山德拉' . uniqid();
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
|
||||
$this->assertAccessIsGranted($client, '/admin/user/create');
|
||||
$form = $client->getCrawler()->filter('form[name=user_create]')->form();
|
||||
@@ -188,10 +188,9 @@ class UserControllerTest extends ControllerBaseTest
|
||||
$client->followRedirect();
|
||||
$this->assertHasFlashDeleteSuccess($client);
|
||||
|
||||
// SQLIte does not necessarly support onCascade delete, so these timesheet will stay after deletion
|
||||
// $em->clear();
|
||||
// $timesheets = $em->getRepository(Timesheet::class)->count([]);
|
||||
// $this->assertEquals(0, $timesheets);
|
||||
$em->clear();
|
||||
$timesheets = $em->getRepository(Timesheet::class)->count([]);
|
||||
$this->assertEquals(0, $timesheets);
|
||||
|
||||
$this->request($client, '/admin/user/' . $user->getId() . '/edit');
|
||||
$this->assertFalse($client->getResponse()->isSuccessful());
|
||||
|
||||
Reference in New Issue
Block a user