本文整理汇总了PHP中TestHelper::arrayToDar方法的典型用法代码示例。如果您正苦于以下问题:PHP TestHelper::arrayToDar方法的具体用法?PHP TestHelper::arrayToDar怎么用?PHP TestHelper::arrayToDar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestHelper
的用法示例。
在下文中一共展示了TestHelper::arrayToDar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: itBuildsAnEmptyFreestyleCollectionIfThereIsNothingInTheDaoAndNoStatus
public function itBuildsAnEmptyFreestyleCollectionIfThereIsNothingInTheDaoAndNoStatus()
{
stub($this->tracker)->getStatusField()->returns(null);
stub($this->dao)->searchColumnsByTrackerId(42)->returns(TestHelper::arrayToDar());
$columns = $this->factory->getDashboardColumns($this->tracker, $this->swimline_tracker);
$this->assertIsA($columns, 'Cardwall_OnTop_Config_ColumnFreestyleCollection');
$this->assertEqual(0, count($columns));
}
示例2: GivenThereWasAlreadyTenCallToAddProject
private function GivenThereWasAlreadyTenCallToAddProject()
{
$dao = new MockSOAP_RequestLimitatorDao();
$time30minutesAgo = $_SERVER['REQUEST_TIME'] - 30 * 60;
$dar = TestHelper::arrayToDar(array('method_name' => 'addProject', 'date' => $time30minutesAgo));
$dao->setReturnValue('searchFirstCallToMethod', $dar);
$dao->setReturnValue('foundRows', 10);
$dao->expectOnce('saveCallToMethod', array('addProject', '*'));
return $dao;
}
示例3: GivenAFullApacheConf
private function GivenAFullApacheConf()
{
$backend = TestHelper::getPartialMock('LDAP_BackendSVN', array('_getServiceDao', 'getLdap', 'getLDAPProjectManager', 'getSVNApacheAuthFactory'));
$dar = TestHelper::arrayToDar(array('unix_group_name' => 'gpig', 'group_name' => 'Guinea Pig', 'group_id' => 101), array('unix_group_name' => 'garden', 'group_name' => 'The Garden Project', 'group_id' => 102));
$dao = new MockServiceDao();
$dao->setReturnValue('searchActiveUnixGroupByUsedService', $dar);
$backend->setReturnValue('_getServiceDao', $dao);
$factory = TestHelper::getPartialMock('SVN_Apache_Auth_Factory', array('getEventManager'));
$factory->setReturnValue('getEventManager', new LDAP_BackendSVNTestEventManager());
$backend->setReturnValue('getSVNApacheAuthFactory', $factory);
return $backend->getApacheConf();
}
示例4: itCatchExceptionsInSystemEvents
public function itCatchExceptionsInSystemEvents()
{
$system_event = partial_mock('SysteEvent_For_Testing_Purpose', array('process', 'notify', 'verbalizeParameters'));
$types = array('some_type');
stub($this->system_event_manager)->getTypesForQueue()->returns($types);
$this->system_event_dao->setReturnValueAt(0, 'checkOutNextEvent', TestHelper::arrayToDar(array('whatever')));
stub($this->system_event_manager)->getInstanceFromRow()->returns($system_event);
$system_event->throwOn('process', new RuntimeException('Something wrong happened'));
$category = SystemEvent::DEFAULT_QUEUE;
$this->processor->execute($category);
$this->assertEqual($system_event->getStatus(), SystemEvent::STATUS_ERROR);
$this->assertEqual($system_event->getLog(), 'Something wrong happened');
}
示例5: testGetWithChildren
function testGetWithChildren()
{
$tracker = aTracker()->withId(1)->build();
$dao = new MockTracker_Hierarchy_Dao();
$children_ids = TestHelper::arrayToDar(array('parent_id' => 1, 'child_id' => 2), array('parent_id' => 1, 'child_id' => 3));
$dao->setReturnValue('getChildren', $children_ids, array($tracker->getId()));
$child1 = aTracker()->withId(2)->build();
$child2 = aTracker()->withId(3)->build();
$tracker_factory = new MockTrackerFactory();
$tracker_factory->setReturnValue('getTrackerById', $child1, array(2));
$tracker_factory->setReturnValue('getTrackerById', $child2, array(3));
$factory = new Tracker_Hierarchy_HierarchicalTrackerFactory($tracker_factory, $dao);
$hierarchical_tracker = $factory->getWithChildren($tracker);
$children = $hierarchical_tracker->getChildren();
$children = $this->assertChildEquals($children, $child1);
$children = $this->assertChildEquals($children, $child2);
$this->assertEqual(count($children), 0);
}
示例6: GivenAFullApacheConf
private function GivenAFullApacheConf()
{
$backend = TestHelper::getPartialMock('LDAP_BackendSVN', array('_getServiceDao', 'getLdap', 'getLDAPProjectManager', 'getSVNApacheAuthFactory'));
$project_array_01 = array('unix_group_name' => 'gpig', 'group_name' => 'Guinea Pig', 'group_id' => 101);
$project_array_02 = array('unix_group_name' => 'garden', 'group_name' => 'The Garden Project', 'group_id' => 102);
$dar = TestHelper::arrayToDar($project_array_01, $project_array_02);
$dao = new MockServiceDao();
$dao->setReturnValue('searchActiveUnixGroupByUsedService', $dar);
$backend->setReturnValue('_getServiceDao', $dao);
$ldap = mock('LDAP');
stub($ldap)->getLDAPParam('server')->returns('ldap://ldap.tuleap.com');
stub($ldap)->getLDAPParam('dn')->returns('dc=tuleap,dc=com');
$project_manager = mock('ProjectManager');
$event_manager = new LDAP_BackendSVNTestEventManager();
$token_manager = mock('SVN_TokenUsageManager');
$factory = new SVN_Apache_Auth_Factory($project_manager, $event_manager, $token_manager);
$backend->setReturnValue('getSVNApacheAuthFactory', $factory);
return $backend->getApacheConf();
}
示例7: itIsNeitherRestrictedNorActive
public function itIsNeitherRestrictedNorActive()
{
$this->user_stub->getStatus()->returns('Not exists');
$this->user_stub->getProjects()->returns(array());
$this->user_stub->isMember()->returns(false);
$this->user_stub->getAllUgroups()->returns(TestHelper::arrayToDar());
$groups = $this->ugroup_literalizer->getUserGroupsForUserName('john_do');
$this->assertEqual(array(), $groups);
}
示例8: itIsNotPossibleToRemoveAllAdminsOfAProject
function itIsNotPossibleToRemoveAllAdminsOfAProject()
{
$ugroup_id = $GLOBALS['UGROUP_PROJECT_ADMIN'];
$group_id = 300;
$ugroup = TestHelper::getPartialMock('UGroup', array('_getUserGroupDao'));
$project_admin_dar = TestHelper::arrayToDar(array('LastAdmin'));
$dao = stub('UserGroupDao')->returnProjectAdminsByGroupId($group_id)->returns($project_admin_dar);
stub($ugroup)->_getUserGroupDao()->returns($dao);
$ugroup->__construct(array('ugroup_id' => $ugroup_id, 'group_id' => $group_id));
$dao->expectNever('updateUserGroupFlags');
$this->expectException();
$ugroup->removeUser($this->user);
}
示例9: testGetFieldFromTrackerAndSharedField
public function testGetFieldFromTrackerAndSharedField()
{
$original_field_dar = TestHelper::arrayToDar($this->createRow(999, 'text'));
$dao = new MockTracker_FormElement_FieldDao();
$dao->setReturnValue('searchFieldFromTrackerIdAndSharedFieldId', $original_field_dar, array(66, 123));
$factory = $this->GivenAFormElementFactory();
$factory->setReturnValue('getDao', $dao);
$originalField = aTextField()->withId(999)->build();
$tracker = aTracker()->withId(66)->build();
$exportedField = aTextField()->withId(123)->build();
$this->assertEqual($factory->getFieldFromTrackerAndSharedField($tracker, $exportedField), $originalField);
}
示例10: itReturnsNothingIfThereIsNoAssociatedPlanning
public function itReturnsNothingIfThereIsNoAssociatedPlanning()
{
$tracker = aMockTracker()->withId(99)->build();
$empty_dar = TestHelper::arrayToDar();
$dao = stub('PlanningDao')->searchByPlanningTrackerId()->returns($empty_dar);
$factory = aPlanningFactory()->withDao($dao)->build();
$this->assertNull($factory->getPlanningByPlanningTracker($tracker));
}
示例11: itLoadValueMappingsEvenForStatusField
public function itLoadValueMappingsEvenForStatusField()
{
stub($this->dao)->searchMappingFields($this->tracker->getId())->returns(TestHelper::arrayToDar(array('tracker_id' => 10, 'field_id' => null)));
stub($this->value_mapping_factory)->getStatusMappings($this->tracker_10, $this->columns)->once();
$this->factory->getMappings($this->tracker, $this->columns);
}
示例12: itReturnOnlyPlanningsWhereTheUserCanViewTrackers
public function itReturnOnlyPlanningsWhereTheUserCanViewTrackers()
{
$tracker1 = new MockTracker();
stub($tracker1)->userCanView($this->user)->returns(true);
$tracker2 = new MockTracker();
stub($tracker2)->userCanView($this->user)->returns(false);
$factoryBuilder = aPlanningFactory();
$factoryBuilder->tracker_factory->setReturnValue('getTrackerById', $tracker1, array(103));
$factoryBuilder->tracker_factory->setReturnValue('getTrackerById', $tracker2, array(104));
$result_set = TestHelper::arrayToDar(array('id' => 1, 'name' => 'Release Backlog', 'group_id' => 102, 'planning_tracker_id' => 103, 'backlog_title' => 'Release Backlog', 'plan_title' => 'Sprint Plan'), array('id' => 2, 'name' => 'Product Backlog', 'group_id' => 102, 'planning_tracker_id' => 104, 'backlog_title' => 'Release Backlog', 'plan_title' => 'Sprint Plan'));
$factoryBuilder->dao->setReturnValue('searchPlannings', $result_set);
$expected = array(new Planning(1, 'Release Backlog', 102, 'Release Backlog', 'Sprint Plan'));
$this->assertEqual($expected, $factoryBuilder->build()->getPlannings($this->user, 123));
}
示例13: testGetProjectRepositoryListShouldReturnProjectRepositories
function testGetProjectRepositoryListShouldReturnProjectRepositories()
{
$projectId = 42;
$userId = 24;
$project_repos = array(array('id' => '1', 'name' => 'a'), array('id' => '2', 'name' => 'b'));
$sandra_repos = array(array('id' => '3', 'name' => 'c'));
$repo_owners = TestHelper::arrayToDar(array(array('id' => '123'), array('id' => '456')));
$dao = new MockGitDao();
$dao->setReturnValue('getProjectRepositoryList', $project_repos, array($projectId, false, true, null));
$dao->setReturnValue('getProjectRepositoryList', $sandra_repos, array($projectId, false, true, $userId));
$dao->setReturnValue('getProjectRepositoriesOwners', $repo_owners, array($projectId));
$controller = new MockGit();
$controller->expectAt(0, 'addData', array(array('repository_list' => $project_repos, 'repositories_owners' => $repo_owners)));
$controller->expectAt(1, 'addData', array(array('repository_list' => $sandra_repos, 'repositories_owners' => $repo_owners)));
$action = TestHelper::getPartialMock('GitActions', array('getDao'));
$action->setController($controller);
$action->setReturnValue('getDao', $dao);
$action->getProjectRepositoryList($projectId);
$action->getProjectRepositoryList($projectId, $userId);
}
示例14: itProvidesTheUserNames
public function itProvidesTheUserNames()
{
$dar = TestHelper::arrayToDar(aUser()->withUserName('Nicolas')->build(), aUser()->withUserName('Johan')->build());
$users = new Users($dar);
$this->assertEqual($users->getNames(), array('Nicolas', 'Johan'));
}
示例15: itDoesntRemoveTheGerritReservedKeys
public function itDoesntRemoveTheGerritReservedKeys()
{
$this->user_manager->setReturnValueAt(0, 'getUsersWithSshKey', TestHelper::arrayToDar(new PFUser(array('authorized_keys' => $this->key1, 'user_name' => 'john_do'))));
$this->mass_dumper->dumpSSHKeys();
$keyfile = 'forge__gerrit_1@0.pub';
touch($this->_glAdmDir . '/keydir/' . $keyfile);
$this->gitExec->add($this->_glAdmDir . '/keydir/' . $keyfile);
$this->gitExec->commit("Gerrit key");
$this->assertEmptyGitStatus();
$this->user_manager->setReturnValueAt(1, 'getUsersWithSshKey', TestHelper::emptyDar());
$this->mass_dumper->dumpSSHKeys();
$this->assertFalse(is_file($this->_glAdmDir . '/keydir/john_do@0.pub'));
$this->assertTrue(is_file($this->_glAdmDir . '/keydir/' . $keyfile));
}