public function testUserListView() { global $mod_strings; // new employee $last_name = 'Test_46923_' . time(); $user = new User(); $user->last_name = $last_name; $user->default_team = 1; $user->status = 'Active'; $user->employee_status = 'Active'; $user->user_name = 'test_user_name'; $user->save(); $user_id = $user->id; $this->assertNotNull($user_id, 'User id should not be null.'); // list view $view = new EmployeesViewList(); $GLOBALS['action'] = 'index'; $GLOBALS['module'] = 'Employees'; $_REQUEST['module'] = 'Employees'; $view->init($user); $view->lv = new ListViewSmarty(); $view->display(); // ensure the new user shows up in the employees list view $this->expectOutputRegex('/.*' . $last_name . '.*/'); // cleanup unset($GLOBALS['action']); unset($GLOBALS['module']); unset($_REQUEST['module']); $GLOBALS['db']->query("delete from users where id='{$user_id}'"); }
private function getEmployeeListViewOutput() { require_once 'modules/Employees/views/view.list.php'; $employeeViewList = new EmployeesViewList(); $employeeViewList->module = 'Employees'; return $employeeViewList->getModuleTitle(true); }