/**
  * try to search timesheets of another user with account filter + acl filtering (should find 1 ts)
  * 
  * @see 0006244: user filter does not work
  */
 public function testSearchTimesheetsOfAnotherUser()
 {
     $taData = $this->_saveTimeaccountWithGrants();
     $scleverId = Tinebase_User::getInstance()->getFullUserByLoginName('sclever')->getId();
     // add ts for sclever
     $timesheet = $this->_getTimesheet(array('account_id' => $scleverId, 'timeaccount_id' => $taData['id']));
     $timesheetData = $this->_json->saveTimesheet($timesheet->toArray());
     Timetracker_ControllerTest::removeManageAllRight();
     $filterData = $this->_getTSFilterDataByUser($scleverId);
     $search = $this->_json->searchTimesheets($filterData, array());
     $this->assertEquals(1, $search['totalcount']);
     $this->assertEquals($scleverId, $search['results'][0]['account_id']['accountId']);
 }
Пример #2
0
 /**
  * try to search timesheets with or filter + acl filtering (should find only 1 ts)
  * @see http://forge.tine20.org/mantisbt/view.php?id=5684
  */
 public function testSearchTimesheetsWithOrAndAclFilter()
 {
     // add another ts that does not match the filter
     $timesheet = $this->_getTimesheet(array('start_date' => Tinebase_DateTime::now()->subWeek(2)->toString('Y-m-d')));
     $timesheetData = $this->_json->saveTimesheet($timesheet->toArray());
     Timetracker_ControllerTest::removeManageAllRight();
     $this->testSearchTimesheetsWithOrFilter();
 }
 /**
  * try to update a Timesheet with a closed TimeAccount
  *
  */
 public function testUpdateClosedTimeaccount()
 {
     $timeaccountData = $this->_saveTimeaccountWithGrants();
     $timeaccountData['is_open'] = 0;
     $timeaccount = $this->_json->saveTimeaccount($timeaccountData);
     $timesheet = $this->_getTimesheet(array('timeaccount_id' => $timeaccount['id']));
     $timesheetData = $this->_json->saveTimesheet($timesheet->toArray());
     Timetracker_ControllerTest::removeManageAllRight();
     $this->setExpectedException('Tinebase_Exception_AccessDenied');
     // update Timesheet
     $timesheetData['description'] = "blubbblubb";
     $timesheetData['account_id'] = $timesheetData['account_id']['accountId'];
     $timesheetData['timeaccount_id'] = $timesheetData['timeaccount_id']['id'];
     $timesheetUpdated = $this->_json->saveTimesheet($timesheetData);
 }