コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     PluginManager::instance()->invalidateCache();
     PluginFactory::clearInstance();
     $this->old_globals = $GLOBALS;
     $GLOBALS['feedback'] = '';
     $GLOBALS['svn_prefix'] = '/tmp';
     $GLOBALS['cvs_prefix'] = '/tmp';
     $GLOBALS['grpdir_prefix'] = '/tmp';
     $GLOBALS['ftp_frs_dir_prefix'] = '/tmp';
     $GLOBALS['ftp_anon_dir_prefix'] = '/tmp';
     $GLOBALS['sys_default_domain'] = '';
     $GLOBALS['sys_cookie_prefix'] = '';
     $GLOBALS['sys_force_ssl'] = 0;
     ForgeConfig::store();
     $this->old_sys_pluginsroot = $GLOBALS['sys_pluginsroot'];
     $this->old_sys_custompluginsroot = $GLOBALS['sys_custompluginsroot'];
     $GLOBALS['sys_pluginsroot'] = dirname(__FILE__) . '/../../plugins/';
     $GLOBALS['sys_custompluginsroot'] = "/tmp";
     ForgeConfig::set('tuleap_dir', __DIR__ . '/../../');
     ForgeConfig::set('codendi_log', "/tmp/");
     /**
      * HACK
      */
     require_once dirname(__FILE__) . '/../../plugins/fusionforge_compat/include/fusionforge_compatPlugin.class.php';
     $ff_plugin = new fusionforge_compatPlugin();
     $ff_plugin->loaded();
     PluginManager::instance()->installAndActivate('mediawiki');
     $plugin = PluginManager::instance()->getPluginByName('mediawiki');
     EventManager::instance()->addListener(Event::IMPORT_XML_PROJECT, $plugin, 'importXmlProject', false);
     EventManager::instance()->addListener('register_project_creation', $plugin, 'register_project_creation', false);
     EventManager::instance()->addListener(Event::SERVICES_ALLOWED_FOR_PROJECT, $plugin, 'services_allowed_for_project', false);
     putenv('TULEAP_LOCAL_INC=' . dirname(__FILE__) . '/_fixtures/local.inc');
 }
コード例 #2
0
 public function itCreatesUserWithPrefixSetFromConfig()
 {
     $suffix = '-team';
     ForgeConfig::set(GenericUserFactory::CONFIG_KEY_SUFFIX, $suffix);
     $generic_user = $this->factory->create('120', 'my_password');
     $this->assertEqual(substr($generic_user->getUnixName(), -strlen($suffix)), $suffix);
 }
コード例 #3
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::set('codendi_log', '/tmp');
     $this->log_file = tempnam(ForgeConfig::get('codendi_log'), 'codendi_syslog');
     $this->logger = new BackendLogger($this->log_file);
 }
コード例 #4
0
 function testFactoryShouldReturnModStuffIfStuffAuthIsConfiguredForThisProjectAndDefaultConfigIsModPerl()
 {
     $projectInfo = array();
     ForgeConfig::set(SVN_Apache_SvnrootConf::CONFIG_SVN_AUTH_KEY, SVN_Apache_SvnrootConf::CONFIG_SVN_AUTH_PERL);
     $factory = $this->GivenAAuthFactoryWithStuffPlugin();
     $this->assertIsA($factory->get($projectInfo), 'SVN_Apache_ModStuff');
 }
コード例 #5
0
ファイル: LDAPTest.php プロジェクト: pombredanne/tuleap
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('sys_logger_level', 'debug');
     $this->ldap = partial_mock('LDAP', array('search'), array($this->ldap_params, mock('TruncateLevelLogger'), new LdapQueryEscaper()));
 }
コード例 #6
0
 public function setUp()
 {
     ForgeConfig::store();
     ForgeConfig::set('codendi_log', '/tmp/');
     $this->user = stub('PFUser')->getLdapId()->returns('whatever');
     $this->driver = mock('Git_Driver_Gerrit');
     $this->driver_factory = stub('Git_Driver_Gerrit_GerritDriverFactory')->getDriver()->returns($this->driver);
     $this->user_finder = mock('Git_Driver_Gerrit_UserFinder');
     $this->remote_server_factory = mock('Git_RemoteServer_GerritServerFactory');
     $this->remote_server = stub('Git_RemoteServer_GerritServer')->getId()->returns(25);
     $this->gerrit_user = mock('Git_Driver_Gerrit_User');
     $this->gerrit_user_manager = mock('Git_Driver_Gerrit_UserAccountManager');
     $this->project = mock('Project');
     $this->u_group = mock('ProjectUGroup');
     $this->u_group2 = mock('ProjectUGroup');
     $this->u_group3 = mock('ProjectUGroup');
     $this->git_repository = mock('GitRepository');
     $this->project_manager = mock('ProjectManager');
     stub($this->u_group)->getProject()->returns($this->project);
     stub($this->u_group2)->getProject()->returns($this->project);
     stub($this->u_group3)->getProject()->returns($this->project);
     stub($this->project_manager)->getChildProjects()->returns(array());
     stub($this->remote_server_factory)->getServer()->returns($this->remote_server);
     stub($this->project)->getUnixName()->returns($this->project_name);
     stub($this->gerrit_user_manager)->getGerritUser($this->user)->returns($this->gerrit_user);
 }
コード例 #7
0
 public function itSavesNothingIfThereAreNoProjectLanguageAndMoreThanOneSystemLanguage()
 {
     ForgeConfig::set('sys_supported_languages', 'it_IT,ja_JP');
     stub($this->dao)->getUsedLanguageForProject()->returns(false);
     expect($this->dao)->updateLanguageOption()->never();
     $this->language_manager->getUsedLanguageForProject($this->project);
 }
コード例 #8
0
 public function setUp()
 {
     parent::setUp();
     $this->fixtures_dir = dirname(__FILE__) . '/_fixtures';
     $this->citation_stripper = new Tracker_Artifact_MailGateway_CitationStripper();
     ForgeConfig::store();
     ForgeConfig::set('sys_strip_outlook', 1);
 }
コード例 #9
0
 public function itHasALogFileFromConfiguration()
 {
     ForgeConfig::store();
     ForgeConfig::set(SVN_Apache_SvnrootConf::CONFIG_SVN_LOG_PATH, '${APACHE_LOG_DIR}/tuleap_svn.log');
     $conf = $this->GivenAFullApacheConfWithModPerl();
     $this->assertPattern('%\\${APACHE_LOG_DIR}/tuleap_svn\\.log%', $conf);
     ForgeConfig::restore();
 }
コード例 #10
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('tmp_dir', $this->getTempDir());
     $this->creator = new Tracker_XML_Updater_TemporaryFileCreator();
     $this->initial = dirname(__FILE__) . '/_fixtures/toto.txt';
 }
コード例 #11
0
 public function setUp()
 {
     parent::setUp();
     $this->fixtures_dir = dirname(__FILE__) . '/_fixtures';
     $this->project_manager = mock('ProjectManager');
     $this->factory = new Tuleap_TourFactory($this->project_manager, mock('Url'));
     $this->user = mock('PFUser');
     ForgeConfig::set('sys_custom_incdir', $this->fixtures_dir);
 }
コード例 #12
0
 public function itDoesNotGetToursIfCustomTourFolderDoesntExist()
 {
     $request_uri = '';
     ForgeConfig::set('sys_custom_incdir', $this->fixtures_dir . '/somewhereElse');
     $user = mock('PFUser');
     stub($user)->getLocale()->returns('en_US');
     $tours = $this->factory->getToursForPage($user, $request_uri);
     $this->assertEqual(count($tours), 0);
 }
コード例 #13
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('sys_dbhost', 'db_server');
     ForgeConfig::set('sys_dbname', 'db');
     ForgeConfig::set('svn_prefix', '/svnroot');
     ForgeConfig::set('sys_dbauth_user', 'dbauth_user');
     ForgeConfig::set('sys_dbauth_passwd', 'dbauth_passwd');
 }
コード例 #14
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('tuleap_dir', __DIR__ . '/../../../../../');
     $this->a_user = aUser()->withId(101)->withUserName('kshen')->withRealName('Kool Shen')->withEmail('*****@*****.**')->withLdapId('cb9867')->build();
     $this->another_user = aUser()->withId(102)->withUserName('jstar')->withRealName('Joeystarr <script>')->withEmail('*****@*****.**')->build();
     $this->none = aUser()->withId(100)->build();
     $this->collection = new UserXMLExportedCollection(new XML_RNGValidator(), new XML_SimpleXMLCDATAFactory());
 }
コード例 #15
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::set('DEBUG_MODE', true);
     if (self::$db_initialized == false) {
         self::$db_initialized = true;
         $this->initDb();
     }
     $this->mysqli->select_db($GLOBALS['sys_dbname']);
     db_connect();
 }
コード例 #16
0
ファイル: BackendCVSTest.php プロジェクト: pombredanne/tuleap
 function setUp()
 {
     $GLOBALS['cvs_prefix'] = dirname(__FILE__) . '/_fixtures/cvsroot';
     $GLOBALS['cvslock_prefix'] = dirname(__FILE__) . '/_fixtures/var/lock/cvs';
     $GLOBALS['tmp_dir'] = dirname(__FILE__) . '/_fixtures/var/tmp';
     $GLOBALS['cvs_cmd'] = "/usr/bin/cvs";
     $GLOBALS['cvs_root_allow_file'] = dirname(__FILE__) . '/_fixtures/etc/cvs_root_allow';
     ForgeConfig::store();
     ForgeConfig::set('sys_project_backup_path', dirname(__FILE__) . '/_fixtures/var/tmp');
     mkdir($GLOBALS['cvs_prefix'] . '/' . 'toto');
 }
コード例 #17
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
     $milestone_controller_factory = mock('Planning_MilestoneControllerFactory');
     $this->planning_controller = mock('Planning_Controller');
     $this->router = TestHelper::getPartialMock('AgileDashboardRouter', array('renderAction', 'executeAction', 'buildController', 'buildPlanningController', 'getArtifactFactory'));
     $this->router->__construct(mock('Plugin'), mock('Planning_MilestoneFactory'), mock('PlanningFactory'), mock('Planning_ShortAccessFactory'), $milestone_controller_factory, mock('ProjectManager'), mock('AgileDashboard_XMLFullStructureExporter'), mock('AgileDashboard_KanbanManager'), mock('AgileDashboard_ConfigurationManager'), mock('AgileDashboard_KanbanFactory'), mock('PlanningPermissionsManager'), mock('AgileDashboard_HierarchyChecker'));
     stub($this->router)->buildPlanningController()->returns($this->planning_controller);
     stub($milestone_controller_factory)->getMilestoneController()->returns(mock('Planning_MilestoneController'));
 }
コード例 #18
0
 public function setUp()
 {
     parent::setUp();
     $this->system_event_manager = mock('SystemEventManager');
     $this->system_event_dao = mock('SystemEventDao');
     $this->logger = mock('Logger');
     $this->site_cache = mock('SiteCache');
     $this->processor = partial_mock('SystemEventProcessor_Root', array('launchAs'), array(new SystemEventProcessRootDefaultQueue(), $this->system_event_manager, $this->system_event_dao, $this->logger, mock('BackendAliases'), mock('BackendCVS'), mock('BackendSVN'), mock('BackendSystem'), $this->site_cache));
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', '/usr/share/codendi');
     ForgeConfig::set('sys_http_user', $this->sys_http_user);
 }
コード例 #19
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
     $this->planning_id = '321';
     $this->user = aUser()->withId(12)->build();
     $this->request = aRequest()->with('planning_id', $this->planning_id)->withUser($this->user)->build();
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     $this->current_milestone_artifact_id = 444;
     $milestone = aMilestone()->withArtifact(anArtifact()->withId($this->current_milestone_artifact_id)->build())->build();
     stub($this->milestone_factory)->getLastMilestoneCreated($this->user, $this->planning_id)->returns($milestone);
 }
コード例 #20
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_log', dirname(__FILE__));
     if (!self::$defect_tracker_converted && $this->thisTestIsNotUnderDevelopment()) {
         $this->convertTrackers();
     }
     $this->form_element_factory = Tracker_FormElementFactory::instance();
     $this->tracker_factory = TrackerFactory::instance();
     $this->defect_tracker = $this->tracker_factory->getTrackerById(self::$defect_tracker_id);
     $this->task_tracker = $this->tracker_factory->getTrackerById(self::$task_tracker_id);
 }
コード例 #21
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
     $planning_id = "99876387";
     $aid = -1;
     $this->planning_tracker_id = 66;
     $this->request = aRequest()->withUri("/plugins/agiledashboard/?group_id=104&action=show&planning_id={$planning_id}&aid={$aid}")->build();
     $this->planning = aPlanning()->withId($planning_id)->withPlanningTrackerId($this->planning_tracker_id)->build();
     $planning_factory = mock('PlanningFactory');
     stub($planning_factory)->getPlanning($planning_id)->returns($this->planning);
     $this->controller = new Planning_ArtifactCreationController($planning_factory, $this->request);
 }
コード例 #22
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
     $this->user_manager = mock('UserManager');
     $this->request = mock('Codendi_Request');
     $this->planning_factory = mock('PlanningFactory');
     $this->kanban_manager = mock('AgileDashboard_KanbanManager');
     $this->config_manager = mock('AgileDashboard_ConfigurationManager');
     $this->tracker_factory = mock('TrackerFactory');
     $this->kanban_factory = mock('AgileDashboard_KanbanFactory');
     UserManager::setInstance($this->user_manager);
 }
コード例 #23
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('sys_http_user', 'codendiadm');
     $this->plugin = stub('Plugin')->getServiceShortname()->returns('docman');
     $this->retriever = mock('Docman_SystemCheckProjectRetriever');
     $logger = mock('BackendLogger');
     $backend = BackendSystem::instance();
     $this->root_dir_path = dirname(__FILE__) . '/_fixtures/';
     $plugin_info = stub('DocmanPluginInfo')->getPropertyValueForName('docman_root')->returns($this->root_dir_path);
     stub($this->plugin)->getPluginInfo()->returns($plugin_info);
     $this->system_check = new Docman_SystemCheck($this->plugin, $this->retriever, $backend, $logger);
 }
コード例 #24
0
 function setUp()
 {
     $GLOBALS['homedir_prefix'] = dirname(__FILE__) . '/_fixtures/home/users';
     $GLOBALS['grpdir_prefix'] = dirname(__FILE__) . '/_fixtures/home/groups';
     $GLOBALS['codendi_shell_skel'] = dirname(__FILE__) . '/_fixtures/etc/skel_codendi';
     $GLOBALS['tmp_dir'] = dirname(__FILE__) . '/_fixtures/var/tmp';
     $GLOBALS['ftp_frs_dir_prefix'] = dirname(__FILE__) . '/_fixtures/var/lib/codendi/ftp/codendi';
     $GLOBALS['ftp_anon_dir_prefix'] = dirname(__FILE__) . '/_fixtures/var/lib/codendi/ftp/pub';
     $GLOBALS['sys_file_deletion_delay'] = 5;
     $GLOBALS['sys_custom_incdir'] = $GLOBALS['tmp_dir'];
     $GLOBALS['sys_incdir'] = $GLOBALS['tmp_dir'];
     $GLOBALS['codendi_log'] = $GLOBALS['tmp_dir'];
     ForgeConfig::store();
     ForgeConfig::set('sys_project_backup_path', dirname(__FILE__) . '/_fixtures/var/tmp');
 }
コード例 #25
0
ファイル: ProjectImportTest.php プロジェクト: ansarbek/tuleap
 public function setUp()
 {
     parent::setUp();
     $GLOBALS['feedback'] = '';
     $GLOBALS['svn_prefix'] = '/tmp';
     $GLOBALS['cvs_prefix'] = '/tmp';
     $GLOBALS['grpdir_prefix'] = '/tmp';
     $GLOBALS['ftp_frs_dir_prefix'] = '/tmp';
     $GLOBALS['ftp_anon_dir_prefix'] = '/tmp';
     $GLOBALS['sys_default_domain'] = '';
     $GLOBALS['sys_cookie_prefix'] = '';
     $GLOBALS['sys_force_ssl'] = 0;
     ForgeConfig::store();
     ForgeConfig::set('tuleap_dir', __DIR__ . '/../../');
 }
コード例 #26
0
 public function setUp()
 {
     parent::setUp();
     $this->dao = mock('ArtifactXMLExporterDao');
     $this->dom = new DOMDocument("1.0", "UTF8");
     $this->archive = mock('ZipArchive');
     $node_helper = new ArtifactXMLNodeHelper($this->dom);
     $attachment_exporter = new ArtifactAttachmentXMLZipper($node_helper, $this->dao, $this->archive, false);
     $this->logger = mock('Logger');
     $this->exporter = new ArtifactXMLExporter($this->dao, $attachment_exporter, $node_helper, $this->logger);
     $this->fixtures_dir = dirname(__FILE__) . '/_fixtures/';
     $this->expected_open_date = $this->toExpectedDate($this->open_date);
     ForgeConfig::store();
     ForgeConfig::set('sys_data_dir', dirname($this->fixtures_dir));
 }
コード例 #27
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
     $this->plugin_path = '/plugin/path';
     $this->product = aMilestone()->withArtifact(aMockArtifact()->withId(1)->withTitle('Product X')->build())->build();
     $this->release = aMilestone()->withArtifact(aMockArtifact()->withId(2)->withTitle('Release 1.0')->build())->build();
     $this->sprint = aMilestone()->withArtifact(aMockArtifact()->withId(3)->withTitle('Sprint 1')->build())->build();
     $this->nomilestone = stub('Planning_NoMilestone')->getPlanning()->returns(mock('Planning'));
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     $this->project_manager = mock('ProjectManager');
     $this->current_user = aUser()->build();
     $this->request = aRequest()->withUser($this->current_user)->with('group_id', 102)->build();
     $this->project = mock('Project');
     stub($this->project_manager)->getProject(102)->returns($this->project);
 }
コード例 #28
0
 public function itCreatesCacheDirectories()
 {
     $cache_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tuleap_cache_dir';
     $combined_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tuleap_combined_dir';
     $lang_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tuleap_lang_dir';
     ForgeConfig::set('codendi_cache_dir', $cache_dir);
     ForgeConfig::set('sys_combined_dir', $combined_dir);
     $logger = mock('Logger');
     $language = stub('BaseLanguage')->getCacheDirectory()->returns($lang_dir);
     $GLOBALS['Language'] = $language;
     $site_cache = new SiteCache($logger);
     $site_cache->restoreCacheDirectories();
     $this->assertTrue(is_dir($cache_dir));
     $this->assertTrue(is_dir($combined_dir));
     $this->assertTrue(is_dir($lang_dir));
     rmdir($cache_dir);
     rmdir($combined_dir);
     rmdir($lang_dir);
 }
コード例 #29
0
 public function setUp()
 {
     parent::setUp();
     $dao = mock("SvnNotificationDao");
     $dao->setReturnValue('setSvnMailingList', true);
     $this->svn_notification_dao = $dao;
     // Create a temporary home, else svnadmin will complain it cannot access
     // its ~/.svnadmin directory
     $this->old_homedir = getenv('HOME');
     putenv("HOME=" . parent::getTmpDir());
     $this->importer = new SVNXMLImporter(mock('Logger'), $this->svn_notification_dao);
     // Create a temp dir with subversion repositories
     $tmp_dir = parent::getTmpDir();
     ForgeConfig::store();
     ForgeConfig::set('svn_prefix', $tmp_dir);
     $this->temp_project_dir = $tmp_dir . DIRECTORY_SEPARATOR . 'test_project';
     $return_status = 0;
     $out = array();
     exec('svnadmin create ' . escapeshellarg($this->temp_project_dir) . ' 2>&1', $out, $return_status);
     $this->assertEqual(0, $return_status, implode($out));
 }
コード例 #30
0
 function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', TRACKER_BASE_DIR . '/../../..');
     $this->group_id = 123;
     $this->request = aRequest()->with('group_id', "{$this->group_id}")->build();
     $this->planning_factory = mock('PlanningFactory');
     $this->tracker_factory = mock('TrackerFactory');
     $kanban_factory = stub('AgileDashboard_KanbanFactory')->getKanbanTrackerIds()->returns(array());
     $this->planning_controller = new Planning_Controller($this->request, $this->planning_factory, mock('Planning_ShortAccessFactory'), mock('Planning_MilestoneFactory'), mock('ProjectManager'), mock('AgileDashboard_XMLFullStructureExporter'), '/path/to/theme', '/path/to/plugin', mock('AgileDashboard_KanbanManager'), mock('AgileDashboard_ConfigurationManager'), $kanban_factory, mock('PlanningPermissionsManager'));
     $GLOBALS['Language'] = new MockBaseLanguage_Planning_ControllerNewTest();
     $this->available_backlog_trackers = array(aTracker()->withId(101)->withName('Stories')->build(), aTracker()->withId(102)->withName('Releases')->build(), aTracker()->withId(103)->withName('Sprints')->build());
     $this->available_planning_trackers = array(aTracker()->withId(101)->withName('Stories')->build(), aTracker()->withId(103)->withName('Sprints')->build());
     stub($this->planning_factory)->buildNewPlanning($this->group_id)->returns(aPlanning()->withGroupId($this->group_id)->build());
     $this->renderNew();
 }