Release 2.14 (#4710)
- show "link has expired message" in password reset screen - added date objects as hydrator variables - for custom date formats in invoice templates - show meta-fields with null values (e.g. booleans with `false` where hidden) - fix permission check: allow to remove `view_own_timesheet` but still record times - prevent error 500 if customer country is empty - fix API 500 error if project does not exist when creating new timesheet - fix tags are not created in remote-search mode - do not check "export items" by default - fix daterange query, if user an request locale are different - added logging for invalid SAML responses (see various discussions)
This commit is contained in:
@@ -465,7 +465,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'hourlyRate' => 127,
|
||||
'billable' => false
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -494,7 +496,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'hourlyRate' => 127,
|
||||
'billable' => true
|
||||
];
|
||||
$this->request($client, '/api/timesheets?full=true', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets?full=true', 'POST', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -526,7 +530,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'end' => ($dateTime->createDateTime())->format('Y-m-d H:m:0'),
|
||||
'description' => 'foo',
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -571,7 +577,60 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'end' => (new \DateTime())->format('Y-m-d H:m:s'),
|
||||
'description' => 'foo',
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertApiCallValidationError($client->getResponse(), ['project']);
|
||||
}
|
||||
|
||||
public function testPostActionWithUnknownActivity(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$customer = new Customer('foo-bar-1');
|
||||
$customer->setVisible(false);
|
||||
$customer->setCountry('DE');
|
||||
$customer->setTimezone('Europe/Berlin');
|
||||
$em->persist($customer);
|
||||
$project = new Project();
|
||||
$project->setName('foo-bar-2');
|
||||
$project->setVisible(true);
|
||||
$project->setCustomer($customer);
|
||||
$em->persist($project);
|
||||
|
||||
$data = [
|
||||
'begin' => (new \DateTime('- 8 hours'))->format('Y-m-d H:m:s'),
|
||||
'end' => (new \DateTime())->format('Y-m-d H:m:s'),
|
||||
'project' => $project->getId(),
|
||||
'activity' => 99,
|
||||
];
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertApiCallValidationError($client->getResponse(), ['project']);
|
||||
}
|
||||
|
||||
public function testPostActionWithNonExistingProject(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$activity = new Activity();
|
||||
$activity->setName('foo-bar-3');
|
||||
$activity->setVisible(true);
|
||||
$em->persist($activity);
|
||||
$em->flush();
|
||||
|
||||
$data = [
|
||||
'begin' => (new \DateTime('- 8 hours'))->format('Y-m-d H:m:s'),
|
||||
'end' => (new \DateTime())->format('Y-m-d H:m:s'),
|
||||
'project' => 99,
|
||||
'activity' => $activity->getId(),
|
||||
];
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertApiCallValidationError($client->getResponse(), ['project']);
|
||||
}
|
||||
|
||||
@@ -605,7 +664,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'end' => (new \DateTime())->format('Y-m-d H:m'),
|
||||
'description' => 'foo',
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertApiCallValidationError($client->getResponse(), ['activity']);
|
||||
}
|
||||
|
||||
@@ -635,7 +696,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'end' => (new \DateTime())->format('Y-m-d H:m'),
|
||||
'description' => 'foo',
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -674,7 +737,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'description' => 'foo',
|
||||
'billable' => true,
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -700,7 +765,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'description' => 'foo',
|
||||
'billable' => false,
|
||||
];
|
||||
$this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -739,7 +806,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'description' => 'foo',
|
||||
'exported' => true,
|
||||
];
|
||||
$this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], $json);
|
||||
$response = $client->getResponse();
|
||||
$this->assertApiResponseAccessDenied($response);
|
||||
}
|
||||
@@ -761,7 +830,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'end' => (new \DateTime('- 1 hours'))->format('Y-m-d H:m'),
|
||||
'description' => 'foo',
|
||||
];
|
||||
$this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], $json);
|
||||
|
||||
$response = $client->getResponse();
|
||||
self::assertEquals(400, $response->getStatusCode());
|
||||
@@ -1066,7 +1137,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'description' => 'foo',
|
||||
'tags' => ['another', 'testing', 'bar']
|
||||
];
|
||||
$this->request($client, '/api/timesheets/' . $id, 'PATCH', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets/' . $id, 'PATCH', [], $json);
|
||||
|
||||
$this->request($client, '/api/timesheets/' . $id . '/restart', 'PATCH');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -1100,7 +1173,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'description' => 'foo',
|
||||
'tags' => ['another', 'testing', 'bar']
|
||||
];
|
||||
$this->request($client, '/api/timesheets/' . $id, 'PATCH', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets/' . $id, 'PATCH', [], $json);
|
||||
|
||||
$begin = new \DateTime('2019-11-27 13:55:00');
|
||||
$this->request($client, '/api/timesheets/' . $id . '/restart', 'PATCH', ['begin' => $begin->format(BaseApiController::DATE_FORMAT_PHP)]);
|
||||
@@ -1211,7 +1286,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'fixedRate' => 2016,
|
||||
'hourlyRate' => 127
|
||||
];
|
||||
$this->request($client, '/api/timesheets', 'POST', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets', 'POST', [], $json);
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -1343,7 +1420,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
'name' => 'metatestmock',
|
||||
'value' => 'another,testing,bar'
|
||||
];
|
||||
$this->request($client, '/api/timesheets/' . $id . '/meta', 'PATCH', [], json_encode($data));
|
||||
$json = json_encode($data);
|
||||
self::assertIsString($json);
|
||||
$this->request($client, '/api/timesheets/' . $id . '/meta', 'PATCH', [], $json);
|
||||
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user