本文整理汇总了PHP中stub函数的典型用法代码示例。如果您正苦于以下问题:PHP stub函数的具体用法?PHP stub怎么用?PHP stub使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stub函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: itThrowsAProjectDeletionExceptionIfThereAreOpenChanges
public function itThrowsAProjectDeletionExceptionIfThereAreOpenChanges()
{
$exception = new Git_Driver_Gerrit_RemoteSSHCommandFailure(1, '', 'error');
stub($this->ssh)->execute()->throws($exception);
$this->expectException('ProjectDeletionException');
$this->driver->deleteProject($this->gerrit_server, 'project');
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:Gerrit_DeletePluginTest.php
示例2: itDoesNotDisableIfItIsNotAlreadyTheCase
public function itDoesNotDisableIfItIsNotAlreadyTheCase()
{
$request = aRequest()->with('use_freestyle_columns', '0')->build();
stub($this->dao)->isFreestyleEnabled($this->tracker_id)->returns(false);
stub($this->dao)->disableFreestyleColumns()->never();
$this->command->execute($request);
}
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:EnableFreestyleColumnsTest.php
示例3: setUp
public function setUp()
{
parent::setUp();
$this->bc1 = stub('BreadCrumb_BreadCrumbGenerator')->getCrumbs()->returns(array('lvl1' => "Toto", 'lvl2' => "Tata"));
$this->bc2 = stub('BreadCrumb_BreadCrumbGenerator')->getCrumbs()->returns(array('lvl3' => "Tutu"));
$this->bc3 = stub('BreadCrumb_BreadCrumbGenerator')->getCrumbs()->returns(array('lvl4' => "Tralala"));
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:MergerTest.php
示例4: itRemovesAllIncludedGroups
public function itRemovesAllIncludedGroups()
{
$groupname = "parent group";
$url_get_members = $this->gerrit_server_host . ':' . $this->gerrit_server_port . '/a/groups/' . urlencode($groupname) . '/groups';
$response_with_included_groups = <<<EOS
)]}'
[
{
"kind": "gerritcodereview#group",
"url": "#/admin/groups/uuid-6ef56904c11e6d53c8f2f3657353faaac74bfc6d",
"options": {},
"group_id": 7,
"owner": "enalean",
"owner_id": "6ef56904c11e6d53c8f2f3657353faaac74bfc6d",
"id": "6ef56904c11e6d53c8f2f3657353faaac74bfc6d",
"name": "enalean"
},
{
"kind": "gerritcodereview#group",
"url": "#/admin/groups/uuid-b99e4455ca98f2ec23d9250f69617e34ceae6bd6",
"options": {},
"group_id": 6,
"owner": "another group",
"owner_id": "b99e4455ca98f2ec23d9250f69617e34ceae6bd6",
"id": "b99e4455ca98f2ec23d9250f69617e34ceae6bd6",
"name": "another group"
}
]
EOS;
stub($this->guzzle_client)->get($url_get_members, '*')->returns($this->getGuzzleRequestWithTextResponse($response_with_included_groups));
$url = $this->gerrit_server_host . ':' . $this->gerrit_server_port . '/a/groups/' . urlencode($groupname) . '/groups.delete';
expect($this->guzzle_client)->post($url, array(Git_Driver_GerritREST::HEADER_CONTENT_TYPE => Git_Driver_GerritREST::MIME_JSON, 'verify' => false), json_encode(array('groups' => array('enalean', 'another group'))))->once();
stub($this->guzzle_client)->post()->returns($this->guzzle_request);
$this->driver->removeAllIncludedGroups($this->gerrit_server, $groupname);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:35,代码来源:GerritREST_removeIncludedGroupTestPHP53.php
示例5: 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
示例6: itDoesNotDisableIfItIsNotAlreadyTheCase
public function itDoesNotDisableIfItIsNotAlreadyTheCase()
{
$request = aRequest()->with('cardwall_on_top', '0')->build();
stub($this->dao)->isEnabled($this->tracker_id)->returns(false);
stub($this->dao)->disable()->never();
$this->command->execute($request);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:EnableCardwallOnTopTest.php
示例7: itThrowsAnExceptionIfFieldIsNotAlphaNumeric
public function itThrowsAnExceptionIfFieldIsNotAlphaNumeric()
{
$values = array('msb' => 'whatever');
stub($this->form_element_factory)->getUsedFieldByName(101, 'msb')->returns($this->field_msb);
$this->expectException('Tracker_FormElement_RESTValueByField_NotImplementedException');
$this->validator->getFieldsDataOnCreateFromValuesByField($values, $this->tracker);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:ArtifactValidatorTestPHP53.php
示例8: itDoesNotCallTheAfterMethodOnWorkflowWhenSaveOfArtifactFails
public function itDoesNotCallTheAfterMethodOnWorkflowWhenSaveOfArtifactFails()
{
stub($this->changeset_dao)->create()->returns(true);
stub($this->artifact_factory)->save()->returns(false);
expect($this->workflow)->after()->never();
$this->creator->create($this->artifact, $this->fields_data, $this->submitter, $this->submitted_on);
}
开发者ID:amanikamail,项目名称:tuleap,代码行数:7,代码来源:InitialChangesetCreatorTest.php
示例9: withValueForChangesetId
public function withValueForChangesetId($value_id, $changeset_id)
{
$bind = mock('Tracker_FormElement_Field_List_Bind_Static');
stub($this->field)->getBind()->returns($bind);
stub($bind)->getChangesetValues($changeset_id)->returns(array(array('id' => $value_id)));
return $this;
}
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:aMockField.php
示例10: setUp
public function setUp()
{
$this->_globals = $GLOBALS;
$this->fixturesPath = dirname(__FILE__) . '/_fixtures';
$git_plugin = stub('GitPlugin')->areFriendlyUrlsActivated()->returns(false);
$this->url_manager = new Git_GitRepositoryUrlManager($git_plugin);
}
开发者ID:rinodung,项目名称:tuleap,代码行数:7,代码来源:GitBackendTest.php
示例11: build
public function build()
{
$ugroup = mock('ProjectUGroup');
stub($ugroup)->getId()->returns($this->id);
stub($ugroup)->getNormalizedName()->returns($this->normalized_name);
return $ugroup;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:aMockUGroup.php
示例12: itThrowsAnExceptionIfUserNotAdmin
public function itThrowsAnExceptionIfUserNotAdmin()
{
stub($this->kanban_actions_checker)->checkUserCanAdministrate($this->user, $this->kanban)->throws(new AgileDashboard_UserNotAdminException($this->user));
expect($this->column_dao)->setColumnWipLimit($this->kanban_id, $this->column_id, $this->wip_limit)->never();
$this->expectException("AgileDashboard_UserNotAdminException");
$this->kanban_column_manager->updateWipLimit($this->user, $this->kanban, $this->column, $this->wip_limit);
}
开发者ID:ansarbek,项目名称:tuleap,代码行数:7,代码来源:KanbanColumnManagerTest.php
示例13: itCreatesUserWithNoSuffixByDefault
public function itCreatesUserWithNoSuffixByDefault()
{
$project_name = 'vla';
stub($this->project)->getUnixName()->returns($project_name);
$generic_user = $this->factory->create('120', 'my_password');
$this->assertEqual(substr($generic_user->getUnixName(), -strlen($project_name)), $project_name);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:GenericUserFactoryTest.php
示例14: itDelegatesToPlanningItem
public function itDelegatesToPlanningItem()
{
$trackers = array(mock('Tracker'), mock('Tracker'));
$planning_item = stub('Planning_Item')->getAllowedChildrenTypes()->returns($trackers);
$presenter = new Planning_ItemPresenter($planning_item, mock('Tracker_CardFields'));
$this->assertEqual($trackers, $presenter->allowedChildrenTypes());
}
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:ItemPresenterTest.php
示例15: itFallsBackToValueStringProcessing
public function itFallsBackToValueStringProcessing()
{
$soap_value = (object) array('field_name' => '', 'field_label' => '', 'field_value' => (object) array('value' => 'Bravo,Zoulou'));
expect($this->bind)->getFieldData('Bravo,Zoulou', true)->once();
stub($this->bind)->getFieldData()->returns(array(1586, 2894));
$this->assertIdentical(array(1586, 2894), $this->field->getFieldDataFromSoapValue($soap_value));
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:Tracker_FormElement_Field_MultiSelectboxTest.php
示例16: setUp
public function setUp()
{
$artifact = aMockArtifact()->withId(123)->withTitle('Foo')->withXRef('milestone #123')->build();
$project = stub('Project')->getID()->returns(456);
$this->milestone = aMilestone()->withArtifact($artifact)->withGroup($project)->withPlanningId(789)->build();
$this->presenter = new Planning_MilestoneLinkPresenter($this->milestone);
}
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:MilestoneLinkPresenterTest.php
示例17: itHasAnArtifact
public function itHasAnArtifact()
{
$artifact = mock('Tracker_Artifact');
$presenter = stub('Cardwall_CardInCellPresenter')->getArtifact()->returns($artifact);
$presenter_node = new Cardwall_CardInCellPresenterNode(new TreeNode(), $presenter);
$this->assertEqual($artifact, $presenter_node->getArtifact());
}
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:CardInCellPresenterNodeTest.php
示例18: itCallsTheRightOptions
public function itCallsTheRightOptions()
{
$url = $this->gerrit_server_host . ':' . $this->gerrit_server_port . '/a/projects/' . urlencode($this->project_name);
expect($this->guzzle_client)->get($url, '*')->once();
stub($this->guzzle_client)->get()->returns($this->guzzle_request);
$this->driver->doesTheParentProjectExist($this->gerrit_server, $this->project_name);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:GerritREST_projectExistsTestPHP53.php
示例19: withFieldForTracker
public function withFieldForTracker($field, $tracker)
{
$semantic = mock('Tracker_Semantic_Title');
stub($semantic)->getField()->returns($field);
stub($this->factory)->getByTracker($tracker)->returns($semantic);
return $this;
}
开发者ID:nterray,项目名称:tuleap,代码行数:7,代码来源:aMockSemanticTitleFactory.php
示例20: setUp
public function setUp()
{
/*
Epic
Release ----,-- Story
Sprint ---' Task
*/
$this->epic_tracker = aTracker()->withId('epic')->withParent(null)->build();
$this->story_tracker = aTracker()->withId('story')->withParent($this->epic_tracker)->build();
$this->task_tracker = aTracker()->withId('task')->withParent($this->story_tracker)->build();
$this->release_tracker = aTracker()->withId('release')->withParent(null)->build();
$this->sprint_tracker = aTracker()->withId('sprint')->withParent($this->epic_tracker)->build();
$release_planning = stub('Planning')->getPlanningTracker()->returns($this->release_tracker);
stub($release_planning)->getPlanningTrackerId()->returns('release');
$sprint_planning = stub('Planning')->getPlanningTracker()->returns($this->sprint_tracker);
stub($sprint_planning)->getPlanningTrackerId()->returns('sprint');
$this->hierarchy = mock('Tracker_Hierarchy');
stub($this->hierarchy)->sortTrackerIds()->returns(array('release', 'sprint'));
$this->hierarchy_factory = mock('Tracker_HierarchyFactory');
stub($this->hierarchy_factory)->getHierarchy()->returns($this->hierarchy);
$this->planning_factory = mock('PlanningFactory');
stub($this->planning_factory)->getPlanningsByBacklogTracker($this->task_tracker)->returns(array());
stub($this->planning_factory)->getPlanningsByBacklogTracker($this->story_tracker)->returns(array($sprint_planning, $release_planning));
stub($this->planning_factory)->getPlanningsByBacklogTracker($this->epic_tracker)->returns(array());
$this->provider = new AgileDashboard_Planning_NearestPlanningTrackerProvider($this->planning_factory);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:26,代码来源:NearestPlanningTrackerProviderTest.php
注:本文中的stub函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论