/**
* try to update a Timesheet with a closed TimeAccount
- *
*/
public function testUpdateClosedTimeaccount()
{
));
$timesheetData = $this->_json->saveTimesheet($timesheet->toArray(), array('skipClosedCheck' => true));
- Timetracker_ControllerTest::removeManageAllRight();
-
- $this->setExpectedException('Timetracker_Exception_ClosedTimeaccount');
-
// update Timesheet
$timesheetData['description'] = "blubbblubb";
$timesheetData['account_id'] = $timesheetData['account_id']['accountId'];
$timesheetData['timeaccount_id'] = $timesheetData['timeaccount_id']['id'];
- $timesheetUpdated = $this->_json->saveTimesheet($timesheetData);
+ try {
+ $timesheetUpdated = $this->_json->saveTimesheet($timesheetData, array('skipClosedCheck' => false));
+ $this->fail('Failed asserting that exception of type "Timetracker_Exception_ClosedTimeaccount" is thrown.');
+ } catch (Timetracker_Exception_ClosedTimeaccount $tect) {
+ $this->assertEquals('This Timeaccount is already closed!', $tect->getMessage());
+ }
}
}
*/
protected function _checkGrant($_record, $_action, $_throw = TRUE, $_errorMessage = 'No Permission.', $_oldRecord = NULL)
{
- if (!$this->_doContainerACLChecks) {
- return true;
- }
-
$isAdmin = false;
// users with MANAGE_TIMEACCOUNTS have all grants here
if ( $this->checkRight(Timetracker_Acl_Rights::MANAGE_TIMEACCOUNTS, FALSE)
protected function _disableTimesheetChecks($tsController)
{
$tsController->doCheckDeadLine(false);
- $tsController->doContainerACLChecks(false);
$tsController->doRightChecks(false);
$tsController->doRelationUpdate(false);
+ $tsController->setRequestContext(array('skipClosedCheck' => true));
}
/**
protected function _enableTimesheetChecks($tsController)
{
$tsController->doCheckDeadLine(true);
- $tsController->doContainerACLChecks(true);
$tsController->doRightChecks(true);
$tsController->doRelationUpdate(true);
+ $tsController->setRequestContext(array('skipClosedCheck' => false));
}
/**