本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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'));
}
示例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;
}
示例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);
}
示例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());
}
示例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());
}
}
示例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);
}
示例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);
}