本文整理汇总了PHP中stub函数的典型用法代码示例。如果您正苦于以下问题:PHP stub函数的具体用法?PHP stub怎么用?PHP stub使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stub函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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);
}
示例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"));
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例11: build
public function build()
{
$ugroup = mock('ProjectUGroup');
stub($ugroup)->getId()->returns($this->id);
stub($ugroup)->getNormalizedName()->returns($this->normalized_name);
return $ugroup;
}
示例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);
}
示例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);
}
示例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());
}
示例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));
}