/** * Say if we can display the remove button on a wiki page * * The wiki page may be driven by another item in the forge (eg a docman document), * therefore wiki administrator shouldn't be able to remove the page. * * @return bool */ function display_remove_button($pagename) { $display_remove_button = true; $em = EventManager::instance(); $em->processEvent(Event::WIKI_DISPLAY_REMOVE_BUTTON, array('display_remove_button' => &$display_remove_button, 'group_id' => GROUP_ID, 'wiki_page' => $pagename)); return $display_remove_button; }
/** * @return string */ function service_replace_template_name_in_link($link, array $template, Project $project) { $link = preg_replace('#(/www/|/projects/|group=)' . $template['name'] . '(/|&|$)#', '$1' . $project->getUnixName() . '$2', $link); $link = preg_replace('/group_id=' . $template['id'] . '([^\\d]|$)/', 'group_id=' . $project->getGroupId() . '$1', $link); EventManager::instance()->processEvent(Event::SERVICE_REPLACE_TEMPLATE_NAME_IN_LINK, array('link' => &$link, 'template' => $template, 'project' => $project)); return $link; }
function _content($params) { if (isset($params['version_number'])) { $version_factory =& $this->_getVersionFactory($params); $version =& $version_factory->getSpecificVersion($params['item'], $params['version_number']); } else { $version =& $params['item']->getCurrentVersion(); } if ($version) { if (file_exists($version->getPath())) { $event_manager =& EventManager::instance(); $event_manager->processEvent('plugin_docman_event_access', array('group_id' => $params['group_id'], 'item' => &$params['item'], 'version' => $version->getNumber(), 'user' => &$params['user'])); $mime = explode('/', $version->getFiletype()); if (in_array($mime[1], array('plain', 'css', 'javascript'))) { $balise = 'pre'; } else { $balise = 'div'; } echo '<' . $balise . ' class="docman_embedded_file_content">'; echo $this->hp->purify(file_get_contents($version->getPath()), CODENDI_PURIFIER_FULL); echo '</' . $balise . '>'; } else { $this->_controller->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_filenotfound')); $v =& new Docman_View_DocmanError($this->_controller); $v->display($params); } } }
public function __construct(ProjectUGroup $ugroup) { parent::__construct($ugroup); $this->permissions_manager = PermissionsManager::instance(); $this->event_manager = EventManager::instance(); $this->html_purifier = Codendi_HTMLPurifier::instance(); }
public function getContent() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'"); if (db_numrows($res_admin) > 0) { $user_helper = UserHelper::instance(); $hp = Codendi_HTMLPurifier::instance(); $em = EventManager::instance(); echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />'; while ($row_admin = db_fetch_array($res_admin)) { $display_name = ''; $em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name)); if (!$display_name) { $display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id'])); } echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />'; } } echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />'; // count of developers on this project $res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id)); echo db_numrows($res_count); echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>'; }
protected function __construct() { $this->charts = null; $this->chart_factories = array(); $em = EventManager::instance(); $em->processEvent('graphontrackersv5_load_chart_factories', array('factories' => &$this->chart_factories)); }
private function buildAdditionnalPanesInfo(Planning_Milestone $milestone, array &$panes_info) { if (!$milestone->getArtifact()) { return; } EventManager::instance()->processEvent(AGILEDASHBOARD_EVENT_ADDITIONAL_PANES_INFO_ON_MILESTONE, array('milestone' => $milestone, 'user' => $this->user, 'pane_info_list' => &$panes_info)); }
/** * The singleton method * * @return EventManager */ public static function instance() { if (!self::$instance) { self::$instance = new EventManager(); } return self::$instance; }
public static function instance() { if (!self::$instance) { self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache()); } return self::$instance; }
/** @return User_LoginPresenter */ public function build($return_to, $printer_version, $form_loginname) { $presenter = new User_LoginPresenter($return_to, $printer_version, $form_loginname, $this->getToggleSSL()); $authoritative = false; EventManager::instance()->processEvent('login_presenter', array('presenter' => &$presenter, 'authoritative' => &$authoritative)); return $presenter; }
public static function instance() { if (!self::$instance) { self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache(), new ForgeUpgradeConfig(new System_Command())); } return self::$instance; }
public function testCanBeDisplayedReturnsTrueIfPlatformCanUseGerritAndGerritServersSet() { $plugin = new GitViews_RepoManagement_Pane_GerritTest_LDAP_FakePlugin(); EventManager::instance()->addListener(GIT_EVENT_PLATFORM_CAN_USE_GERRIT, $plugin, 'git_event_platform_can_use_gerrit', false); $gerrit_servers = array('IAmAServer'); $pane = new GitViews_RepoManagement_Pane_Gerrit($this->repository, $this->request, $this->driver_factory, $gerrit_servers, array()); $this->assertTrue($pane->canBeDisplayed()); }
protected function getCombinedScripts() { $arr = array('/scripts/polyphills/json2.js', '/scripts/polyphills/storage.js', '/scripts/prototype/prototype.js', '/scripts/protocheck/protocheck.js', '/scripts/scriptaculous/scriptaculous.js', '/scripts/scriptaculous/builder.js', '/scripts/scriptaculous/effects.js', '/scripts/scriptaculous/dragdrop.js', '/scripts/scriptaculous/controls.js', '/scripts/scriptaculous/slider.js', '/scripts/scriptaculous/sound.js', '/scripts/jquery/jquery-1.9.1.min.js', '/scripts/jquery/jquery-ui.min.js', '/scripts/jquery/jquery-noconflict.js', '/scripts/tuleap/browser-compatibility.js', '/scripts/tuleap/project-history.js', '/scripts/bootstrap/bootstrap-dropdown.js', '/scripts/bootstrap/bootstrap-button.js', '/scripts/bootstrap/bootstrap-modal.js', '/scripts/bootstrap/bootstrap-collapse.js', '/scripts/bootstrap/bootstrap-tooltip.js', '/scripts/bootstrap/bootstrap-tooltip-fix-prototypejs-conflict.js', '/scripts/bootstrap/bootstrap-popover.js', '/scripts/bootstrap/bootstrap-select/bootstrap-select.js', '/scripts/bootstrap/bootstrap-tour/bootstrap-tour.min.js', '/scripts/bootstrap/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', '/scripts/bootstrap/bootstrap-datetimepicker/js/bootstrap-datetimepicker.fr.js', '/scripts/bootstrap/bootstrap-datetimepicker/js/bootstrap-datetimepicker-fix-prototypejs-conflict.js', '/scripts/jscrollpane/jquery.mousewheel.js', '/scripts/jscrollpane/jquery.jscrollpane.min.js', '/scripts/select2/select2.min.js', '/scripts/vendor/at/js/caret.min.js', '/scripts/vendor/at/js/atwho.min.js', '/scripts/viewportchecker/viewport-checker.js', '/scripts/clamp.js', '/scripts/codendi/common.js', '/scripts/tuleap/massmail_initialize_ckeditor.js', '/scripts/tuleap/is-at-top.js', '/scripts/tuleap/get-style-class-property.js', '/scripts/tuleap/listFilter.js', '/scripts/codendi/feedback.js', '/scripts/codendi/CreateProject.js', '/scripts/codendi/cross_references.js', '/scripts/codendi/Tooltip.js', '/scripts/codendi/Toggler.js', '/scripts/codendi/LayoutManager.js', '/scripts/codendi/DropDownPanel.js', '/scripts/codendi/colorpicker.js', '/scripts/autocomplete.js', '/scripts/textboxlist/multiselect.js', '/scripts/tablekit/tablekit.js', '/scripts/lytebox/lytebox.js', '/scripts/lightwindow/lightwindow.js', '/scripts/codendi/RichTextEditor.js', '/scripts/codendi/Tracker.js', '/scripts/codendi/TreeNode.js', '/scripts/tuleap/tuleap-modal.js', '/scripts/tuleap/tuleap-tours.js', '/scripts/tuleap/tuleap-standard-homepage.js', '/scripts/placeholder/jquery.placeholder.js', '/scripts/tuleap/datetimepicker.js', '/scripts/tuleap/svn.js', '/scripts/tuleap/account-maintenance.js', '/scripts/tuleap/search.js', '/scripts/tuleap/tuleap-mention.js', '/scripts/tuleap/project-privacy-tooltip.js', '/scripts/tuleap/massmail_project_members.js', '/scripts/tuleap/manage-allowed-projects-on-resource.js', '/scripts/admin/system_events.js'); EventManager::instance()->processEvent(Event::COMBINED_SCRIPTS, array('scripts' => &$arr)); $arr[] = '/scripts/d3/d3.min.js'; //last - incompatible with IE7 return $arr; }
public function save(Tracker_Permission_PermissionRequest $request, Tracker_Permission_PermissionSetter $permission_setter) { $tracker = $permission_setter->getTracker(); if ($this->checkPermissionValidity($request, $tracker)) { $this->getChainOfResponsability()->apply($request, $permission_setter); EventManager::instance()->processEvent(TRACKER_EVENT_TRACKER_PERMISSIONS_CHANGE, array('tracker' => $tracker)); } }
public function getContent() { $pane = null; EventManager::instance()->processEvent(AGILEDASHBOARD_EVENT_INDEX_PAGE, array('milestone' => $this->milestone, 'user' => $this->user, 'pane' => &$pane, 'milestone_factory' => $this->milestone_factory)); if ($pane) { return $pane->getMinimalContent(); } return ''; }
private function getDocumentSearchTypes(array $facets) { $types = array(); $types[] = array('key' => 'wiki', 'name' => $GLOBALS['Language']->getText('wiki_service', 'search_wiki_type'), 'info' => false, 'can_use' => true, 'special' => false); $em = EventManager::instance(); $em->processEvent(FULLTEXTSEARCH_EVENT_FETCH_ALL_DOCUMENT_SEARCH_TYPES, array('all_document_search_types' => &$types)); $this->setSelectedSearchTypes($types, $facets); return $types; }
public function show() { $milestone = $this->milestone_factory->getLastMilestoneCreated($this->request->getCurrentUser(), $this->request->getValidated('planning_id', 'uint', 0)); if ($milestone->getArtifact()) { $redirect_parameters = array('group_id' => $milestone->getGroupId(), 'planning_id' => $milestone->getPlanningId(), 'action' => 'show', 'aid' => $milestone->getArtifact()->getId()); EventManager::instance()->processEvent(AGILEDASHBOARD_EVENT_MILESTONE_SELECTOR_REDIRECT, array('milestone' => $milestone, 'redirect_parameters' => &$redirect_parameters)); $this->redirect($redirect_parameters); } }
/** * * @param PFUser $user * * @return Git_Driver_Gerrit_User|null */ public function getGerritUser(PFUser $user) { $ldap_user = null; $params = array('ldap_user' => &$ldap_user, 'user' => $user); EventManager::instance()->processEvent(Event::GET_LDAP_LOGIN_NAME_FOR_USER, $params); if ($ldap_user) { return new Git_Driver_Gerrit_User($ldap_user); } else { return null; } }
public function buildNavBarItemPresentersCollection() { $collection = new FlamingParrot_NavBarItemPresentersCollection(); $this->addMyItem($collection); $this->addProjectsItem($collection); $this->addHelpItem($collection); $this->addMoarItem($collection); $this->addAdminItem($collection); EventManager::instance()->processEvent(Event::NAVBAR_ITEMS, array('items' => $collection, 'selected_top_tab' => $this->selected_top_tab, 'request_uri' => $this->request_uri)); return $collection; }
public function cssFile($params) { $include_tracker_css_file = false; EventManager::instance()->processEvent(TRACKER_EVENT_INCLUDE_CSS_FILE, array('include_tracker_css_file' => &$include_tracker_css_file)); // Only show the stylesheet if we're actually in the tracker pages. // This stops styles inadvertently clashing with the main site. if ($include_tracker_css_file || strpos($_SERVER['REQUEST_URI'], $this->getPluginPath()) === 0 || strpos($_SERVER['REQUEST_URI'], '/my/') === 0 || strpos($_SERVER['REQUEST_URI'], '/projects/') === 0 || strpos($_SERVER['REQUEST_URI'], '/widgets/') === 0) { echo '<link rel="stylesheet" type="text/css" href="' . $this->getThemePath() . '/css/style.css" />'; echo '<link rel="stylesheet" type="text/css" href="' . $this->getThemePath() . '/css/print.css" media="print" />'; echo '<!--[if lte IE 8]><link rel="stylesheet" type="text/css" href="' . $this->getThemePath() . '/css/ieStyle.css" /><![endif]-->'; } }
public function setUp() { $GLOBALS['alias_file'] = dirname(__FILE__) . '/_fixtures/etc/aliases.codendi'; $this->alias_file = $GLOBALS['alias_file']; $udao = mock('UserDao'); stub($udao) ->searchByStatus() ->returnsDar( array( "user_name"=> "user1", "email" => "*****@*****.**" ), array( "user_name"=> "user2", "email" => "*****@*****.**" ), array( "user_name"=> "user3", "email" => "*****@*****.**" ) ); $listdao = mock('MailingListDao'); stub($listdao) ->searchAllActiveML() ->returnsDar( array("list_name"=> "list1"), array("list_name"=> "list2"), array("list_name"=> "list3"), array("list_name"=> "list4") ); $this->backend = partial_mock( 'BackendAliases', array( 'getUserDao', 'getMailingListDao', 'system' ) ); stub($this->backend)->getUserDao()->returns($udao); stub($this->backend)->getMailingListDao()->returns($listdao); stub($this->backend)->system()->returns(true); $plugin = new BackendAliasesTest_FakePlugin(); EventManager::instance()->addListener( Event::BACKEND_ALIAS_GET_ALIASES, $plugin, 'hook', false, 0 ); }
public function getPossibleArtifactParents(Tracker $parent_tracker, PFUser $user, $limit, $offset) { $label = ''; $possible_parents = array(); $display_selector = true; EventManager::instance()->processEvent(TRACKER_EVENT_ARTIFACT_PARENTS_SELECTOR, array('user' => $user, 'parent_tracker' => $parent_tracker, 'possible_parents' => &$possible_parents, 'label' => &$label, 'display_selector' => &$display_selector)); if (!$possible_parents) { $label = $GLOBALS['Language']->getText('plugin_tracker_artifact', 'formelement_artifactlink_open_parent', array($parent_tracker->getName())); $possible_parents = $this->artifact_factory->getPaginatedPossibleParentArtifactsUserCanView($user, $parent_tracker->getId(), $limit, $offset); } return array($label, $possible_parents, $display_selector); }
function getContent() { require_once 'www/forum/forum_utils.php'; require_once 'www/project/admin/ugroup_utils.php'; $html_my_admin = ''; // Get the number of pending users and projects db_query("SELECT count(*) AS count FROM groups WHERE status='P'"); $row = db_fetch_array(); $pending_projects = $row['count']; if ($GLOBALS['sys_user_approval'] == 1) { db_query("SELECT count(*) AS count FROM user WHERE status='P'"); $row = db_fetch_array(); $pending_users = $row['count']; } else { db_query("SELECT count(*) AS count FROM user WHERE status='P' OR status='V' OR status='W'"); $row = db_fetch_array(); $pending_users = $row['count']; } db_query("SELECT count(*) AS count FROM user WHERE status='V' OR status='W'"); $row = db_fetch_array(); $validated_users = $row['count']; $sql = "SELECT * FROM news_bytes WHERE is_approved=0 OR is_approved=3"; $result = db_query($sql); $pending_news = 0; $rows = db_numrows($result); for ($i = 0; $i < $rows; $i++) { //if the news is private, not display it in the list of news to be approved $forum_id = db_result($result, $i, 'forum_id'); $res = news_read_permissions($forum_id); // check on db_result($res,0,'ugroup_id') == $UGROUP_ANONYMOUS only to be consistent // with ST DB state if (db_numrows($res) < 1 || db_result($res, 0, 'ugroup_id') == $GLOBALS['UGROUP_ANONYMOUS']) { $pending_news++; } } $i = 0; $html_my_admin .= '<table width="100%">'; $html_my_admin .= $this->_get_admin_row($i++, $GLOBALS['Language']->getText('admin_main', 'pending_user', array("/admin/approve_pending_users.php?page=pending")), $pending_users, $this->_get_color($pending_users)); if ($GLOBALS['sys_user_approval'] == 1) { $html_my_admin .= $this->_get_admin_row($i++, $GLOBALS['Language']->getText('admin_main', 'validated_user', array("/admin/approve_pending_users.php?page=validated")), $validated_users, $this->_get_color($validated_users)); } $html_my_admin .= $this->_get_admin_row($i++, $GLOBALS['Language']->getText('admin_main', 'pending_group', array("/admin/approve-pending.php")), $pending_projects, $this->_get_color($pending_projects)); $html_my_admin .= $this->_get_admin_row($i++, '<a href="/news/admin">' . $GLOBALS['Language']->getText('admin_main', 'site_news_approval') . '</a>', $pending_news, $this->_get_color($pending_news)); $result = array(); $em =& EventManager::instance(); $em->processEvent('widget_myadmin', array('result' => &$result)); foreach ($result as $entry) { $html_my_admin .= $this->_get_admin_row($i++, $entry['text'], $entry['value'], $entry['bgcolor'], isset($entry['textcolor']) ? $entry['textcolor'] : 'white'); } $html_my_admin .= '</table>'; return $html_my_admin; }
/** * @return Tracker_Artifact_XMLImport */ public function build(User\XML\Import\IFindUserFromXMLReference $user_finder) { $artifact_factory = Tracker_ArtifactFactory::instance(); $formelement_factory = Tracker_FormElementFactory::instance(); $fields_validator = new Tracker_Artifact_Changeset_AtGivenDateFieldsValidator($formelement_factory); $changeset_dao = new Tracker_Artifact_ChangesetDao(); $changeset_comment_dao = new Tracker_Artifact_Changeset_CommentDao(); $logger = new Log_ConsoleLogger(); $send_notifications = false; $artifact_creator = new Tracker_ArtifactCreator($artifact_factory, $fields_validator, new Tracker_Artifact_Changeset_InitialChangesetAtGivenDateCreator($fields_validator, $formelement_factory, $changeset_dao, $artifact_factory, EventManager::instance())); $new_changeset_creator = new Tracker_Artifact_Changeset_NewChangesetAtGivenDateCreator($fields_validator, $formelement_factory, $changeset_dao, $changeset_comment_dao, $artifact_factory, EventManager::instance(), ReferenceManager::instance()); return new Tracker_Artifact_XMLImport(new XML_RNGValidator(), $artifact_creator, $new_changeset_creator, Tracker_FormElementFactory::instance(), $user_finder, new Tracker_FormElement_Field_List_Bind_Static_ValueDao(), $logger, $send_notifications); }
/** * @param Codendi_Request $request * * @return AgileDashboardRouter */ public function build(Codendi_Request $request) { $plugin = $this->plugin_factory->getPluginByName(AgileDashboardPlugin::PLUGIN_NAME); $planning_factory = $this->getPlanningFactory(); $milestone_factory = $this->getMilestoneFactory(); $hierarchy_factory = $this->getHierarchyFactory(); $submilestone_finder = new AgileDashboard_Milestone_Pane_Planning_SubmilestoneFinder($hierarchy_factory, $planning_factory); $pane_info_factory = new AgileDashboard_PaneInfoFactory($request->getCurrentUser(), $submilestone_finder, $plugin->getThemePath()); $pane_presenter_builder_factory = $this->getPanePresenterBuilderFactory($milestone_factory, $pane_info_factory); $pane_factory = $this->getPaneFactory($request, $milestone_factory, $pane_presenter_builder_factory, $submilestone_finder, $pane_info_factory, $plugin); $top_milestone_pane_factory = $this->getTopMilestonePaneFactory($request, $pane_presenter_builder_factory, $plugin); $milestone_controller_factory = new Planning_MilestoneControllerFactory($plugin, ProjectManager::instance(), $milestone_factory, $this->getPlanningFactory(), $hierarchy_factory, $pane_presenter_builder_factory, $pane_factory, $top_milestone_pane_factory); return new AgileDashboardRouter($plugin, $milestone_factory, $planning_factory, new Planning_ShortAccessFactory($planning_factory, $pane_info_factory), $milestone_controller_factory, ProjectManager::instance(), new AgileDashboard_XMLFullStructureExporter(EventManager::instance(), $this), $this->getKanbanManager(), $this->getConfigurationManager(), $this->getKanbanFactory(), new PlanningPermissionsManager(), $this->getHierarchyChecker()); }
function _content($params) { if (isset($params['redirect_to'])) { $url = $params['redirect_to']; } else { if (isset($params['item'])) { $event_manager =& EventManager::instance(); $event_manager->processEvent('plugin_docman_event_access', array('group_id' => $params['group_id'], 'item' => &$params['item'], 'user' => &$params['user'])); $url = $params['item']->accept($this, $params); } else { $url = '/'; } } $GLOBALS['Response']->redirect($url); }
/** * Constructor of the class. * It is also used to add FRSLog events to listen in EventManager. * * @return FRSLog */ protected function __construct() { $em = EventManager::instance(); $packageEventToListen = array('frs_create_package', 'frs_update_package', 'frs_delete_package'); foreach ($packageEventToListen as $event) { $em->addListener($event, $this, 'addLogPackage', true); } $releaseEventToListen = array('frs_create_release', 'frs_update_release', 'frs_delete_release'); foreach ($releaseEventToListen as $event) { $em->addListener($event, $this, 'addLogRelease', true); } $fileEventToListen = array('frs_create_file', 'frs_update_file', 'frs_delete_file', 'frs_restore_file'); foreach ($fileEventToListen as $event) { $em->addListener($event, $this, 'addLogFile', true); } }
public function testImportProjectCreatesAProject() { $project_manager = ProjectManager::instance(); $user_manager = UserManager::instance(); $importer = new ProjectXMLImporter(EventManager::instance(), $project_manager, new XML_RNGValidator(), new UGroupManager(), new XMLImportHelper($user_manager), new Log_ConsoleLogger()); $xml_project = dirname(__FILE__) . '/_fixtures/fake_project.xml'; $importer->import(null, $xml_project); // Reset Project Manager (and its cache) ProjectManager::clearInstance(); $project_manager = ProjectManager::instance(); // Check the project was created $project = $project_manager->getProjectByUnixName('toto123'); $this->assertEqual($project->getPublicName(), 'Toto 123'); $this->assertEqual($project->getDescription(), '123 Soleil'); $this->assertEqual($project->usesSVN(), true); $this->assertEqual($project->usesCVS(), false); }
public function setUp() { $this->old_cwd = getcwd(); $this->system_command = new System_Command(); parent::setUp(); $this->old_sys_data_dir = isset($GLOBALS['sys_data_dir']) ? $GLOBALS['sys_data_dir'] : null; $GLOBALS['sys_data_dir'] = parent::getTmpDir(); $GLOBALS['tmp_dir'] = dirname(__FILE__) . '/_fixtures/tmp'; mkdir("{$GLOBALS['sys_data_dir']}/gitolite/admin/", 0777, true); mkdir("{$GLOBALS['sys_data_dir']}/gitolite/repositories/test_project", 0777, true); $sys_data_dir_arg = escapeshellarg($GLOBALS['sys_data_dir']); $this->system_command->exec("chmod -R 777 {$sys_data_dir_arg}/gitolite/repositories"); ForgeConfig::store(); $this->git_dao = new MyMockGitDao(); $plugin_dao = mock('PluginDao'); ProjectManager::clearInstance(); $this->project_manager = ProjectManager::instance(); $this->logger = mock('Logger'); $this->git_plugin = new GitPlugin(1); $this->git_factory = new GitRepositoryFactory($this->git_dao, $this->project_manager); $this->git_systemeventmanager = mock('Git_SystemEventManager'); $this->mirror_updater = mock('GitRepositoryMirrorUpdater'); $this->mirror_data_mapper = mock('Git_Mirror_MirrorDataMapper'); $this->git_manager = new GitRepositoryManager($this->git_factory, $this->git_systemeventmanager, $this->git_dao, parent::getTmpDir(), $this->mirror_updater, $this->mirror_data_mapper); $restricted_plugin_dao = mock('RestrictedPluginDao'); $plugin_factory = new PluginFactory($plugin_dao, new PluginResourceRestrictor($restricted_plugin_dao)); $plugin_manager = new PluginManager($plugin_factory, EventManager::instance(), new SiteCache($this->logger), new ForgeUpgradeConfig(new System_Command())); PluginManager::setInstance($plugin_manager); $this->ugroup_dao = mock('UGroupDao'); $this->ugroup_manager = new UGroupManager($this->ugroup_dao, mock('EventManager')); $this->permission_dao = mock('PermissionsDAO'); $permissions_manager = new PermissionsManager($this->permission_dao); $git_mirror_dao = mock('Git_Mirror_MirrorDao'); $git_gitolite_driver = new Git_GitoliteDriver($this->logger, $this->git_systemeventmanager, mock('Git_GitRepositoryUrlManager'), $this->git_dao, $git_mirror_dao, $this->git_plugin, null, null, mock('Git_Gitolite_ConfigPermissionsSerializer'), null, null, mock('Git_Mirror_MirrorDataMapper')); $gitolite = new Git_Backend_Gitolite($git_gitolite_driver, $this->logger); $this->importer = new GitXmlImporter($this->logger, $this->git_manager, $this->git_factory, $gitolite, $this->git_systemeventmanager, $permissions_manager, $this->ugroup_manager); $this->temp_project_dir = parent::getTmpDir() . DIRECTORY_SEPARATOR . 'test_project'; $userManager = mock('UserManager'); stub($userManager)->getUserById()->returns(new PFUser()); UserManager::setInstance($userManager); stub($this->permission_dao)->clearPermission()->returns(true); stub($this->permission_dao)->addPermission()->returns(true); stub($this->git_dao)->getProjectRepositoryList()->returns(array()); copy(__DIR__ . '/_fixtures/stable_repo_one_commit.bundle', parent::getTmpDir() . DIRECTORY_SEPARATOR . 'stable.bundle'); $this->project = $this->project_manager->getProjectFromDbRow(array('group_id' => 123, 'unix_group_name' => 'test_project', 'access' => Project::ACCESS_PUBLIC)); }
public function __construct() { $this->project_creator = new \ProjectCreator( \ProjectManager::instance(), new \Rule_ProjectName(), new \Rule_ProjectFullName() ); $this->xml_importer = new \ProjectXMLImporter( \EventManager::instance(), \ProjectManager::instance(), new \XML_RNGValidator(), new \UGroupManager(), \UserManager::instance(), new \XMLImportHelper(), new \ProjectXMLImporterLogger() ); }