added internal rates (#1591)

This commit is contained in:
Kevin Papst
2020-04-08 14:50:15 +02:00
committed by GitHub
parent 82c713031e
commit 68d703d1e3
128 changed files with 4044 additions and 1571 deletions

View File

@@ -19,7 +19,6 @@ use App\Entity\User;
use App\Tests\DataFixtures\TimesheetFixtures;
use App\Tests\Mocks\Security\UserDateTimeFactoryFactory;
use App\Tests\Mocks\TimesheetTestMetaFieldSubscriberMock;
use App\Timesheet\UserDateTimeFactory;
use Symfony\Component\HttpFoundation\Response;
/**
@@ -31,21 +30,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
public const DATE_FORMAT_HTML5 = 'Y-m-d\TH:i:s';
public const TEST_TIMEZONE = 'Europe/London';
/**
* @var UserDateTimeFactory
*/
protected $dateTime;
protected function setUp(): void
{
$this->importFixtureForUser(User::ROLE_USER);
$this->dateTime = (new UserDateTimeFactoryFactory($this))->create(self::TEST_TIMEZONE);
}
protected function importFixtureForUser(string $role)
{
$client = $this->getClientForAuthenticatedUser($role);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
$fixture = new TimesheetFixtures();
$fixture
@@ -56,7 +43,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
->setStartDate((new \DateTime('first day of this month'))->setTime(0, 0, 1))
->setAllowEmptyDescriptions(false)
;
$this->importFixture($client, $fixture);
$this->importFixture($this, $fixture);
}
public function testIsSecure()
@@ -67,6 +54,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetCollection()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets');
$result = json_decode($client->getResponse()->getContent(), true);
@@ -79,6 +67,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetCollectionFull()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', ['full' => 'true']);
$result = json_decode($client->getResponse()->getContent(), true);
@@ -92,7 +81,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetCollectionForOtherUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$fixture = new TimesheetFixtures();
$fixture
@@ -117,7 +107,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetCollectionForAllUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$fixture = new TimesheetFixtures();
$fixture
@@ -172,6 +163,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
];
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', $query);
$result = json_decode($client->getResponse()->getContent(), true);
@@ -181,7 +173,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
$this->assertDefaultStructure($result[0], false);
}
public function testGetCollectionWithDeprecatedQuery()
public function testGetCollectionWithSingleParamsQuery()
{
$begin = new \DateTime('first day of this month');
$begin->setTime(0, 0, 0);
@@ -203,6 +195,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
];
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', $query);
$result = json_decode($client->getResponse()->getContent(), true);
@@ -215,7 +208,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testExportedFilter()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$fixture = new TimesheetFixtures();
$fixture
@@ -240,7 +234,6 @@ class TimesheetControllerTest extends APIControllerBaseTest
'exported' => 1,
];
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', $query);
$result = json_decode($client->getResponse()->getContent(), true);
@@ -257,7 +250,6 @@ class TimesheetControllerTest extends APIControllerBaseTest
'exported' => 0,
];
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', $query);
$result = json_decode($client->getResponse()->getContent(), true);
@@ -272,7 +264,6 @@ class TimesheetControllerTest extends APIControllerBaseTest
'begin' => $begin->format(self::DATE_FORMAT_HTML5),
'end' => $end->format(self::DATE_FORMAT_HTML5),
];
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', $query);
$result = json_decode($client->getResponse()->getContent(), true);
@@ -285,6 +276,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetEntity()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets/1');
$result = json_decode($client->getResponse()->getContent(), true);
@@ -294,15 +286,17 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetEntityAccessDenied()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_ADMIN);
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertApiAccessDenied($client, '/api/timesheets/15', 'You are not allowed to view this timesheet');
}
public function testGetEntityAccessAllowedForAdmin()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets/1');
$result = json_decode($client->getResponse()->getContent(), true);
@@ -317,12 +311,13 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testPostAction()
{
$dateTime = (new UserDateTimeFactoryFactory($this))->create(self::TEST_TIMEZONE);
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [
'activity' => 1,
'project' => 1,
'begin' => ($this->dateTime->createDateTime('- 16 hours'))->format('Y-m-d H:m:0'),
'end' => ($this->dateTime->createDateTime())->format('Y-m-d H:m:0'),
'begin' => ($dateTime->createDateTime('- 16 hours'))->format('Y-m-d H:m:0'),
'end' => ($dateTime->createDateTime())->format('Y-m-d H:m:0'),
'description' => 'foo',
'fixedRate' => 2016,
'hourlyRate' => 127
@@ -344,7 +339,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
$customer = (new Customer())->setName('foo-bar-1')->setVisible(false)->setCountry('DE')->setTimezone('Europe/Berlin');
$em->persist($customer);
$project = (new Project())->setName('foo-bar-2')->setVisible(true)->setCustomer($customer);
@@ -372,7 +367,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
$customer = (new Customer())->setName('foo-bar-1')->setVisible(true)->setCountry('DE')->setTimezone('Europe/Berlin');
$em->persist($customer);
$project = (new Project())->setName('foo-bar-2')->setVisible(true)->setCustomer($customer);
@@ -396,12 +391,14 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testPatchAction()
{
$dateTime = (new UserDateTimeFactoryFactory($this))->create(self::TEST_TIMEZONE);
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->importFixtureForUser(User::ROLE_USER);
$data = [
'activity' => 1,
'project' => 1,
'begin' => ($this->dateTime->createDateTime('- 7 hours'))->format('Y-m-d\TH:m:0'),
'end' => ($this->dateTime->createDateTime())->format('Y-m-d\TH:m:0'),
'begin' => ($dateTime->createDateTime('- 7 hours'))->format('Y-m-d\TH:m:0'),
'end' => ($dateTime->createDateTime())->format('Y-m-d\TH:m:0'),
'description' => 'foo',
'exported' => true,
];
@@ -419,7 +416,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testPatchActionWithInvalidUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$fixture = new TimesheetFixtures();
$fixture
@@ -456,6 +454,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testInvalidPatchAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$data = [
'activity' => 10,
'project' => 1,
@@ -475,6 +475,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testDeleteAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/timesheets/1');
$result = json_decode($client->getResponse()->getContent(), true);
@@ -487,32 +488,31 @@ class TimesheetControllerTest extends APIControllerBaseTest
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode());
$this->assertEmpty($client->getResponse()->getContent());
$this->assertEntityNotFound(User::ROLE_USER, '/api/timesheets/' . $id);
}
public function testDeleteActionWithUnknownTimesheet()
{
$this->assertEntityNotFoundForDelete(User::ROLE_ADMIN, '/api/timesheets/255', []);
$this->assertEntityNotFoundForDelete(User::ROLE_ADMIN, '/api/timesheets/255');
}
public function testDeleteActionForDifferentUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->importFixtureForUser(User::ROLE_USER);
$id = 1;
$this->request($client, '/api/timesheets/' . $id, 'DELETE');
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode());
$this->assertEmpty($client->getResponse()->getContent());
$this->assertEntityNotFound(User::ROLE_USER, '/api/timesheets/' . $id);
}
public function testDeleteActionWithoutAuthorization()
{
$this->importFixtureForUser(User::ROLE_ADMIN);
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_ADMIN);
$this->request($client, '/api/timesheets/15', 'DELETE');
@@ -526,8 +526,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testDeleteActionForExportedRecordIsNotAllowed()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$timesheet->setExported(true);
@@ -541,8 +542,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testDeleteActionForExportedRecordIsAllowedForAdmin()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->importFixtureForUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$timesheet->setExported(true);
@@ -556,7 +558,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetRecentCollectionWithSubresources()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
$start = new \DateTime('-10 days');
@@ -589,7 +591,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testActiveAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
$start = new \DateTime('-10 days');
@@ -617,7 +619,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testStopAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$start = new \DateTime('-10 days');
@@ -635,7 +638,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
$this->request($client, '/api/timesheets/11/stop', 'PATCH');
$this->assertTrue($client->getResponse()->isSuccessful());
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$this->assertInstanceOf(\DateTime::class, $timesheet->getEnd());
@@ -644,6 +647,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testStopActionFailsOnStoppedEntry()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->request($client, '/api/timesheets/1/stop', 'PATCH');
$this->assertApiException($client->getResponse(), 'Timesheet entry already stopped');
@@ -657,7 +661,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testStopNotAllowedForUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$start = new \DateTime('-10 days');
@@ -679,7 +684,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetCollectionWithTags()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->importFixtureForUser(User::ROLE_USER);
$em = $this->getEntityManager();
$fixture = new TimesheetFixtures();
$fixture
@@ -724,6 +730,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testRestartAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$data = [
'description' => 'foo',
@@ -739,7 +746,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
$this->assertEmpty($result['description']);
$this->assertEmpty($result['tags']);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find($result['id']);
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
@@ -753,8 +760,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testRestartActionWithCopyData()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$timesheet->setDescription('foo');
@@ -779,7 +787,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
$this->assertEquals([['name' => 'sdfsdf', 'value' => 'nnnnn'], ['name' => '1234567890', 'value' => '1234567890']], $result['metaFields']);
$this->assertEquals(['another', 'testing', 'bar'], $result['tags']);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find($result['id']);
$this->assertInstanceOf(\DateTime::class, $timesheet->getBegin());
@@ -793,7 +801,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testRestartNotAllowedForUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
$start = new \DateTime('-10 days');
@@ -808,7 +817,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
;
$this->importFixture($em, $fixture);
$this->request($client, '/api/timesheets/12/restart', 'PATCH');
$this->request($client, '/api/timesheets/2/restart', 'PATCH');
$this->assertApiResponseAccessDenied($client->getResponse(), 'You are not allowed to re-start this timesheet');
}
@@ -819,12 +828,13 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testDuplicateAction()
{
$dateTime = (new UserDateTimeFactoryFactory($this))->create(self::TEST_TIMEZONE);
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [
'activity' => 1,
'project' => 1,
'begin' => ($this->dateTime->createDateTime('- 16 hours'))->format('Y-m-d H:m:0'),
'end' => ($this->dateTime->createDateTime())->format('Y-m-d H:m:0'),
'begin' => ($dateTime->createDateTime('- 16 hours'))->format('Y-m-d H:m:0'),
'end' => ($dateTime->createDateTime())->format('Y-m-d H:m:0'),
'description' => 'foo',
'fixedRate' => 2016,
'hourlyRate' => 127
@@ -858,32 +868,34 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testExportAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->importFixtureForUser(User::ROLE_USER);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$this->assertEquals(false, $timesheet->isExported());
$this->assertFalse($timesheet->isExported());
$this->request($client, '/api/timesheets/1/export', 'PATCH');
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertDefaultStructure(json_decode($client->getResponse()->getContent(), true), true);
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em->clear();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$this->assertEquals(true, $timesheet->isExported());
$this->assertTrue($timesheet->isExported());
$this->request($client, '/api/timesheets/1/export', 'PATCH');
$this->assertTrue($client->getResponse()->isSuccessful());
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em->clear();
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$this->assertEquals(false, $timesheet->isExported());
$this->assertFalse($timesheet->isExported());
}
public function testExportNotAllowedForUser()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
$this->request($client, '/api/timesheets/1/export', 'PATCH');
$this->assertApiResponseAccessDenied($client->getResponse(), 'You are not allowed to lock this timesheet');
@@ -901,7 +913,10 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testMetaActionThrowsExceptionOnMissingName()
{
return $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/timesheets/1/meta', ['value' => 'X'], [
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
return $this->assertExceptionForMethod($client, '/api/timesheets/1/meta', 'PATCH', ['value' => 'X'], [
'code' => 400,
'message' => 'Parameter "name" of value "NULL" violated a constraint "This value should not be null."'
]);
@@ -909,7 +924,10 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testMetaActionThrowsExceptionOnMissingValue()
{
return $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/timesheets/1/meta', ['name' => 'X'], [
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
return $this->assertExceptionForMethod($client, '/api/timesheets/1/meta', 'PATCH', ['name' => 'X'], [
'code' => 400,
'message' => 'Parameter "value" of value "NULL" violated a constraint "This value should not be null."'
]);
@@ -917,7 +935,10 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testMetaActionThrowsExceptionOnMissingMetafield()
{
return $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/timesheets/1/meta', ['name' => 'X', 'value' => 'Y'], [
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importFixtureForUser(User::ROLE_USER);
return $this->assertExceptionForMethod($client, '/api/timesheets/1/meta', 'PATCH', ['name' => 'X', 'value' => 'Y'], [
'code' => 500,
'message' => 'Unknown meta-field requested'
]);
@@ -926,7 +947,8 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testMetaAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
static::$kernel->getContainer()->get('event_dispatcher')->addSubscriber(new TimesheetTestMetaFieldSubscriberMock());
$this->importFixtureForUser(User::ROLE_USER);
static::$container->get('event_dispatcher')->addSubscriber(new TimesheetTestMetaFieldSubscriberMock());
$data = [
'name' => 'metatestmock',
@@ -936,7 +958,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
$this->assertTrue($client->getResponse()->isSuccessful());
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = $this->getEntityManager();
/** @var Timesheet $timesheet */
$timesheet = $em->getRepository(Timesheet::class)->find(1);
$this->assertEquals('another,testing,bar', $timesheet->getMetaField('metatestmock')->getValue());
@@ -945,7 +967,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
protected function assertDefaultStructure(array $result, $full = true)
{
$expectedKeys = [
'id', 'begin', 'end', 'duration', 'description', 'rate', 'activity', 'project', 'tags', 'user', 'metaFields'
'id', 'begin', 'end', 'duration', 'description', 'rate', 'activity', 'project', 'tags', 'user', 'metaFields', 'internalRate'
];
if ($full) {