当前位置: 首页>>代码示例>>PHP>>正文


PHP TestHelper::getPartialMock方法代码示例

本文整理汇总了PHP中TestHelper::getPartialMock方法的典型用法代码示例。如果您正苦于以下问题:PHP TestHelper::getPartialMock方法的具体用法?PHP TestHelper::getPartialMock怎么用?PHP TestHelper::getPartialMock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestHelper的用法示例。


在下文中一共展示了TestHelper::getPartialMock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GivenAProjectCreator

 /**
  * @return ProjectCreator
  */
 private function GivenAProjectCreator()
 {
     $projectManager = new MockProjectManager();
     $creator = TestHelper::getPartialMock('ProjectCreator', array('createProject'));
     $creator->__construct($projectManager, ReferenceManager::instance());
     return $creator;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:ProjectCreatorTest.php

示例2: testGetFRSPackageFromDb

 function testGetFRSPackageFromDb()
 {
     $packageArray1 = array('package_id' => 1, 'group_id' => 1, 'name' => 'pkg1', 'status_id' => 2, 'rank' => null, 'approve_license' => null, 'data_array' => null, 'package_releases' => null, 'error_state' => null, 'error_message' => null);
     $package1 = FRSPackageFactory::getFRSPackageFromArray($packageArray1);
     $dar1 = new MockDataAccessResult($this);
     $dar1->setReturnValue('isError', false);
     $dar1->setReturnValue('current', $packageArray1);
     $dar1->setReturnValueAt(0, 'valid', true);
     $dar1->setReturnValueAt(1, 'valid', false);
     $dar1->setReturnValue('rowCount', 1);
     $packageArray2 = array('package_id' => 2, 'group_id' => 2, 'name' => 'pkg2', 'status_id' => 1, 'rank' => null, 'approve_license' => null, 'data_array' => null, 'package_releases' => null, 'error_state' => null, 'error_message' => null);
     $package2 = FRSPackageFactory::getFRSPackageFromArray($packageArray2);
     $dar2 = new MockDataAccessResult($this);
     $dar2->setReturnValue('isError', false);
     $dar2->setReturnValue('current', $packageArray2);
     $dar2->setReturnValueAt(0, 'valid', true);
     $dar2->setReturnValueAt(1, 'valid', false);
     $dar2->setReturnValue('rowCount', 1);
     $dar3 = new MockDataAccessResult($this);
     $dar3->setReturnValue('isError', false);
     $dar3->setReturnValue('current', array());
     $dar3->setReturnValueAt(0, 'valid', true);
     $dar3->setReturnValueAt(1, 'valid', false);
     $dar3->setReturnValue('rowCount', 0);
     $dao = new FRSPackageDaoTestVersion();
     $dao->da = TestHelper::getPartialMock('DataAccess', array('DataAccess'));
     $dao->setReturnValue('retrieve', $dar1, array('SELECT p.*  FROM frs_package AS p  WHERE  p.package_id = 1  ORDER BY rank DESC LIMIT 1'));
     $dao->setReturnValue('retrieve', $dar2, array('SELECT p.*  FROM frs_package AS p  WHERE  p.package_id = 2  AND p.status_id != 0  ORDER BY rank DESC LIMIT 1'));
     $dao->setReturnValue('retrieve', $dar3);
     $PackageFactory = new FRSPackageFactoryTestVersion();
     $PackageFactory->setReturnValue('_getFRSPackageDao', $dao);
     $this->assertEqual($PackageFactory->getFRSPackageFromDb(1, null, 0x1), $package1);
     $this->assertEqual($PackageFactory->getFRSPackageFromDb(2), $package2);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:34,代码来源:FRSPackageFactoryTest.php

示例3: itDeletesTheRepository

 public function itDeletesTheRepository()
 {
     $event = TestHelper::getPartialMock('SystemEvent_GIT_REPO_DELETE', array('getRepositoryFactory'));
     $event->setParameters($this->project_id . SystemEvent::PARAMETER_SEPARATOR . $this->repository_id);
     stub($event)->getRepositoryFactory()->returns($this->git_repository_factory);
     $event->process();
 }
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:SystemEvent_GIT_REPO_DELETETest.php

示例4: testIsFieldUsedInWorkflow

 public function testIsFieldUsedInWorkflow()
 {
     $tracker = new MockTracker();
     $tracker->setReturnValue('getId', 123);
     $field_status = new MockTracker_FormElement_Field_List();
     $field_status->setReturnReference('getTracker', $tracker);
     $field_status->setReturnValue('getId', 1001);
     $field_start_date = new MockTracker_FormElement_Field_List();
     $field_start_date->setReturnReference('getTracker', $tracker);
     $field_start_date->setReturnValue('getId', 1002);
     $field_close_date = new MockTracker_FormElement_Field_List();
     $field_close_date->setReturnReference('getTracker', $tracker);
     $field_close_date->setReturnValue('getId', 1003);
     $workflow = new MockWorkflow();
     $workflow->setReturnValue('getFieldId', $field_status->getId());
     $tf = new MockTransitionFactory();
     $tf->setReturnValue('isFieldUsedInTransitions', false, array($field_start_date));
     $tf->setReturnValue('isFieldUsedInTransitions', true, array($field_close_date));
     $tf->expectCallCount('isFieldUsedInTransitions', 2);
     $wf = TestHelper::getPartialMock('WorkflowFactory', array('getWorkflowByTrackerId', 'getTransitionFactory'));
     $wf->setReturnReference('getTransitionFactory', $tf);
     $wf->setReturnReference('getWorkflowByTrackerId', $workflow, array($tracker->getId()));
     $this->assertTrue($wf->isFieldUsedInWorkflow($field_status));
     $this->assertFalse($wf->isFieldUsedInWorkflow($field_start_date));
     $this->assertTrue($wf->isFieldUsedInWorkflow($field_close_date));
 }
开发者ID:nterray,项目名称:tuleap,代码行数:26,代码来源:WorkflowFactoryTest.php

示例5: GivenSvnrootForTwoGroups

 /**
  * @return SVN_Apache_SvnrootConf 
  */
 private function GivenSvnrootForTwoGroups()
 {
     $projects = array(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));
     $factory = TestHelper::getPartialMock('SVN_Apache_Auth_Factory', array('getEventManager'));
     $factory->setReturnValue('getEventManager', new MockEventManager());
     return new SVN_Apache_SvnrootConf($factory, $projects);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:10,代码来源:SVN_Apache_SvnrootConfTest.php

示例6: setUp

 function setUp()
 {
     parent::setUp();
     $this->factory = TestHelper::getPartialMock('Tracker_CrossSearch_SharedFieldFactory', array('getDao'));
     $this->dao = new MockTracker_CrossSearch_SharedFieldDao();
     $this->factory->setReturnValue('getDao', $this->dao);
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:7,代码来源:SharedFieldFactoryTest.php

示例7: GivenAnArtifact

 private function GivenAnArtifact($tracker)
 {
     $artifact = TestHelper::getPartialMock('Tracker_Artifact', array('createNewChangeset', 'getUserManager'));
     $user_manager = stub('UserManager')->getCurrentUser()->returns(aUser()->withId(120)->build());
     stub($artifact)->getUserManager()->returns($user_manager);
     $artifact->setTracker($tracker);
     return $artifact;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:Tracker_Artifact_ProcessAssociateArtifact_Test.php

示例8: testItUsesTheSynchronizerTokenToAvoidDuplicateForks

 public function testItUsesTheSynchronizerTokenToAvoidDuplicateForks()
 {
     $git = TestHelper::getPartialMock('Git', array('checkSynchronizerToken'));
     $git->throwOn('checkSynchronizerToken', new Exception());
     $git->setGroupId(101);
     $this->expectException();
     $git->_doDispatchForkRepositories(null, null);
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:8,代码来源:Git_ForkRepositories_Test.php

示例9: testProjectListMustContainsOnlyProjectsWithGitEnabled

 public function testProjectListMustContainsOnlyProjectsWithGitEnabled()
 {
     $user = $this->GivenAUserWithProjects();
     $project = $this->GivenAProjectWithoutGitService('123', 'Guinea Pig');
     $manager = $this->GivenAProjectManager($project);
     $view = TestHelper::getPartialMock('GitViews', array());
     $this->assertNoPattern('/Guinea Pig/', $view->getUserProjectsAsOptions($user, $manager, '50'));
 }
开发者ID:nterray,项目名称:tuleap,代码行数:8,代码来源:GitViewsTest.php

示例10: partial_mock

function partial_mock($classname, array $mocked_methods, array $construct_params = null)
{
    $object = TestHelper::getPartialMock($classname, $mocked_methods);
    if ($construct_params) {
        call_user_func_array(array($object, '__construct'), $construct_params);
    }
    return $object;
}
开发者ID:nterray,项目名称:tuleap,代码行数:8,代码来源:MockBuilder.php

示例11: testDispatchToForkCrossProjectIfRequestsProject

 public function testDispatchToForkCrossProjectIfRequestsProject()
 {
     $git = TestHelper::getPartialMock('Git', array('_doDispatchForkCrossProject', 'addView'));
     $request = new Codendi_Request(array('choose_destination' => 'project'));
     $git->setRequest($request);
     $git->expectOnce('_doDispatchForkCrossProject');
     $git->_dispatchActionAndView('do_fork_repositories', null, null, null);
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:8,代码来源:GitTest.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $this->field = aMockField()->build();
     $this->from_value = mock('Tracker_FormElement_Field_List_Value');
     $this->to_value = mock('Tracker_FormElement_Field_List_Value');
     $this->xml_mapping = array('F1' => $this->field, 'F32-V1' => $this->from_value, 'F32-V0' => $this->to_value);
     $this->factory = TestHelper::getPartialMock('TransitionFactory', array());
 }
开发者ID:nterray,项目名称:tuleap,代码行数:9,代码来源:TransitionFactoryTest.php

示例13: __construct

 public function __construct()
 {
     $this->factory = TestHelper::getPartialMock('Transition_PostActionFactory', array('getDao', 'getFormElementFactory'));
     $this->form_element_factory = mock('Tracker_FormElementFactory');
     $this->daos = array('field_date' => mock('Transition_PostAction_Field_DateDao'), 'field_int' => mock('Transition_PostAction_Field_IntDao'), 'field_float' => mock('Transition_PostAction_Field_FloatDao'));
     foreach ($this->daos as $short_name => $dao) {
         stub($dao)->searchByTransitionId('*')->returns(array());
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:aPostActionFactory.php

示例14: _itReturnsCrossSearchViewIncludingTheContentView

 public function _itReturnsCrossSearchViewIncludingTheContentView()
 {
     $user = aUser()->build();
     $project = mock('Project');
     $cross_search_query = mock('Tracker_CrossSearch_Query');
     $view_builder = TestHelper::getPartialMock('Tracker_CrossSearch_ViewBuilder', array('buildContentView', 'getService'));
     $view_builder->expectOnce('buildContentView', array($user, $project, $cross_search_query));
     $view_builder->build($user, $project, $cross_search_query);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:9,代码来源:SearchViewBuilderTest.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     $this->user = mock('User');
     $this->field = TestHelper::getPartialMock('Tracker_FormElement_Field_Computed', array('getProperty'));
     stub($this->field)->getProperty()->returns('effort');
     $this->formelement_factory = mock('Tracker_FormElementFactory');
     Tracker_FormElementFactory::setInstance($this->formelement_factory);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:9,代码来源:Tracker_FormElement_Field_ComputedTest.php


注:本文中的TestHelper::getPartialMock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。