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


PHP aMockArtifact函数代码示例

本文整理汇总了PHP中aMockArtifact函数的典型用法代码示例。如果您正苦于以下问题:PHP aMockArtifact函数的具体用法?PHP aMockArtifact怎么用?PHP aMockArtifact使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: itCreatesAnArtifactNodeForEveryArtifactId

 public function itCreatesAnArtifactNodeForEveryArtifactId()
 {
     $swmiline_id = 7;
     $artifact4 = aMockArtifact()->withId(4)->build();
     $artifact5 = aMockArtifact()->withId(5)->build();
     $artifact6 = aMockArtifact()->withId(6)->build();
     $node4 = new Cardwall_CardInCellPresenterNode(new Cardwall_CardInCellPresenter(new Cardwall_CardPresenter($artifact4, mock('Cardwall_CardFields'), '*', mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 0, array()), 4));
     $node5 = new Cardwall_CardInCellPresenterNode(new Cardwall_CardInCellPresenter(new Cardwall_CardPresenter($artifact5, mock('Cardwall_CardFields'), '*', mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 0, array()), 5));
     $node6 = new Cardwall_CardInCellPresenterNode(new Cardwall_CardInCellPresenter(new Cardwall_CardPresenter($artifact6, mock('Cardwall_CardFields'), '*', mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 0, array()), 6));
     stub($this->artifact_factory)->getArtifactById(4)->returns($artifact4);
     stub($this->artifact_factory)->getArtifactById(5)->returns($artifact5);
     stub($this->artifact_factory)->getArtifactById(6)->returns($artifact6);
     stub($this->node_factory)->getCardInCellPresenterNode($artifact4, $swmiline_id)->returns($node4);
     stub($this->node_factory)->getCardInCellPresenterNode($artifact5, $swmiline_id)->returns($node5);
     stub($this->node_factory)->getCardInCellPresenterNode($artifact6, $swmiline_id)->returns($node6);
     $cards = $this->provider->getCards(array(4, 5, 6), $swmiline_id);
     $this->assertEqual(3, count($cards));
     foreach ($cards as $card) {
         $id = $card->getId();
         $this->assertBetweenClosedInterval($id, 4, 6);
         $artifact = $card->getArtifact();
         $this->assertBetweenClosedInterval($artifact->getId(), 4, 6);
         $this->assertIsA($artifact, 'Tracker_Artifact');
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:25,代码来源:RendererBoardBuilder.php

示例2: 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

示例3: itHasJsonRepresentation

 public function itHasJsonRepresentation()
 {
     $timestamp = mktime(1, 1, 1, 9, 25, 2013);
     $changeset = partial_mock('Tracker_Artifact_Changeset', array('getChangeContentForJson'), array(15, aMockArtifact()->build(), 45, $timestamp, ''));
     $template_renderer = mock('TemplateRenderer');
     stub($template_renderer)->renderToString()->returns('body');
     $json_formatter = new Tracker_Artifact_ChangesetJsonFormatter($template_renderer);
     $this->assertEqual($json_formatter->format($changeset), array('id' => 15, 'submitted_by' => 45, 'submitted_on' => date('c', $timestamp), 'email' => '', 'html' => 'body'));
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:Tracker_Artifact_ChangesetJsonFormatterTest.php

示例4: itReturnsZeroWhenUserDoesntHavePermissions

 public function itReturnsZeroWhenUserDoesntHavePermissions()
 {
     $user = aUser()->build();
     $artifact_value = stub('Tracker_Artifact_ChangesetValue_Float')->getValue()->returns(123.45);
     $artifact = aMockArtifact()->withValue($artifact_value)->build();
     $field = TestHelper::getPartialMock('Tracker_FormElement_Field_Float', array('userCanRead'));
     stub($field)->userCanRead($user)->returns(false);
     $actual_value = $field->getComputedValue($user, $artifact);
     $this->assertEqual(0, $actual_value);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:Tracker_FormElement_Field_NumericTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $tracker = mock('Tracker');
     $this->field_id = 77777;
     $this->field = stub('Tracker_FormElement_Field_MultiselectBox')->getId()->returns($this->field_id);
     $this->artifact = aMockArtifact()->withTracker($tracker)->build();
     $this->card_presenter = stub('Cardwall_CardPresenter')->getArtifact()->returns($this->artifact);
     $this->field_provider = stub('Cardwall_FieldProviders_IProvideFieldGivenAnArtifact')->getField($tracker)->returns($this->field);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:CardInCellPresenterFactoryTest.php

示例6: itReturnsNullIfThereIsACustomMappingButNoFieldChoosenYet

 public function itReturnsNullIfThereIsACustomMappingButNoFieldChoosenYet()
 {
     $tracker = aTracker()->build();
     $artifact = aMockArtifact()->withTracker($tracker)->build();
     $status_field = mock('Tracker_FormElement_Field_OpenList');
     $status_retriever = stub('Cardwall_FieldProviders_SemanticStatusFieldRetriever')->getField()->returns($status_field);
     $mapping = stub('Cardwall_OnTop_Config_TrackerMapping')->getField()->returns(null);
     $config = stub('Cardwall_OnTop_Config')->getMappingFor($tracker)->returns($mapping);
     $provider = new Cardwall_OnTop_Config_MappedFieldProvider($config, $status_retriever);
     $this->assertEqual(null, $provider->getField($artifact));
 }
开发者ID:nterray,项目名称:tuleap,代码行数:11,代码来源:MappedFieldProviderTest.php

示例7: itDisplaysASelectorOfArtifactWhenThereAreNoMilestoneSelected

 public function itDisplaysASelectorOfArtifactWhenThereAreNoMilestoneSelected()
 {
     $current_milstone = new Planning_NoMilestone(mock('Project'), $this->sprint_planning);
     $milstone_1001 = aMilestone()->withArtifact(aMockArtifact()->withId(1001)->withTitle('An open artifact')->build())->build();
     $milstone_1002 = aMilestone()->withArtifact(aMockArtifact()->withId(1002)->withTitle('Another open artifact')->build())->build();
     stub($this->milestone_factory)->getAllBareMilestones($this->current_user, $this->sprint_planning)->returns(array($milstone_1001, $milstone_1002));
     $this->pane_factory = new Planning_MilestonePaneFactory4Tests($this->request, $this->milestone_factory, $this->pane_presenter_builder_factory, mock('AgileDashboard_Milestone_Pane_Planning_SubmilestoneFinder'), mock('AgileDashboard_PaneInfoFactory'));
     $selectable_artifacts = $this->pane_factory->getAvailableMilestones($current_milstone);
     $this->assertCount($selectable_artifacts, 2);
     $this->assertEqual(array_shift($selectable_artifacts), $milstone_1001);
     $this->assertEqual(array_shift($selectable_artifacts), $milstone_1002);
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:12,代码来源:MilestonePaneFactoryTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $this->artifact_id = 123;
     $this->changeset_id = 456;
     $this->value_id = 789;
     $this->artifact = aMockArtifact()->withId($this->artifact_id)->build();
     $this->tracker = $this->artifact->getTracker();
     $this->artifact_factory = aMockArtifactFactory()->withArtifact($this->artifact)->build();
     $this->semantic_title_factory = aMockSemanticTitleFactory()->build();
     $this->field = aMockField()->withValueForChangesetId($this->value_id, $this->changeset_id)->build();
     $this->setText('Open', array('plugin_tracker_crosssearch', 'semantic_status_open'));
     $this->setText('Closed', array('plugin_tracker_crosssearch', 'semantic_status_closed'));
 }
开发者ID:nterray,项目名称:tuleap,代码行数:14,代码来源:SemanticValueFactoryTest.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     $value_none = new Tracker_FormElement_Field_List_Bind_StaticValue(100, 'None', '', 0, 0);
     $value_todo = new Tracker_FormElement_Field_List_Bind_StaticValue(101, 'Todo', '', 0, 0);
     $value_inprogress = new Tracker_FormElement_Field_List_Bind_StaticValue(102, 'In Progress', '', 0, 0);
     $value_done = new Tracker_FormElement_Field_List_Bind_StaticValue(103, 'Done', '', 0, 0);
     $mapping_none = new Cardwall_OnTop_Config_ValueMapping($value_none, 10);
     $mapping_todo = new Cardwall_OnTop_Config_ValueMapping($value_todo, 10);
     $mapping_ongoing = new Cardwall_OnTop_Config_ValueMapping($value_inprogress, 11);
     $mapping_done = new Cardwall_OnTop_Config_ValueMapping($value_done, 12);
     $this->value_mappings = array(100 => $mapping_none, 101 => $mapping_todo, 102 => $mapping_ongoing, 103 => $mapping_done);
     $this->mapping = new Cardwall_OnTop_Config_TrackerMappingStatus(mock('Tracker'), array(), $this->value_mappings, aSelectBoxField()->build());
     $this->config = partial_mock('Cardwall_OnTop_Config', array('getMappingFor'));
     $this->artifact = aMockArtifact()->withTracker(aTracker()->build())->build();
 }
开发者ID:nterray,项目名称:tuleap,代码行数:16,代码来源:ConfigTest.php

示例10: itReturnsABoardWithaSwimline

 public function itReturnsABoardWithaSwimline()
 {
     $child_artifact = aMockArtifact()->withId('child')->allUsersCanView()->build();
     $swimline_artifact = aMockArtifact()->withId('whatever')->allUsersCanView()->build();
     stub($swimline_artifact)->getChildrenForUser()->returns(array($child_artifact));
     stub($this->swimline_factory)->getCells()->returns(array());
     $row = array('id' => 'whatever');
     stub($this->artifact_factory)->getInstanceFromRow($row)->returns($swimline_artifact);
     stub($this->dao)->getBacklogArtifacts()->returnsDar($row);
     stub($this->card_in_cell_presenter_builder)->getCardInCellPresenter()->returns(mock('Cardwall_CardInCellPresenter'));
     stub($this->card_in_cell_presenter_builder)->getCardInCellPresenters()->returns(array(mock('Cardwall_CardInCellPresenter')));
     $pane_builder = new Cardwall_PaneBoardBuilder($this->card_in_cell_presenter_builder, $this->artifact_factory, $this->dao, $this->swimline_factory);
     $board = $pane_builder->getBoard($this->user, $this->milestone_artifact, $this->columns, $this->mapping_collection);
     $this->assertCount($board->swimlines, 1);
     $this->assertIsA($board->swimlines[0], 'Cardwall_Swimline');
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:16,代码来源:PaneBoardBuilderTest.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     $this->edit_uri = 'http://someurl';
     $this->xref = 'some #xref';
     $this->title = 'do something interresting';
     $this->id = '234872';
     $epics_tracker_id = 123;
     $stories_tracker_id = 456;
     $this->allowed_children_types = array(aTracker()->withId($stories_tracker_id)->build());
     $this->epics_tracker = aTracker()->withId($epics_tracker_id)->build();
     $this->stories_tracker = aTracker()->withId($stories_tracker_id)->build();
     $this->planning = aPlanning()->withBacklogTrackerId($epics_tracker_id)->build();
     $this->epic = aMockArtifact()->withUri($this->edit_uri)->withXRef($this->xref)->withTitle($this->title)->withTracker($this->epics_tracker)->withAllowedChildrenTypes($this->allowed_children_types)->withId($this->id)->build();
     $this->story = aMockArtifact()->withTracker($this->stories_tracker)->build();
     $this->item = new Planning_Item($this->epic, $this->planning);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:17,代码来源:ItemTest.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
     $this->plugin_path = '/plugin/path';
     $this->product = aMilestone()->withArtifact(aMockArtifact()->withId(1)->withTitle('Product X')->build())->build();
     $this->release = aMilestone()->withArtifact(aMockArtifact()->withId(2)->withTitle('Release 1.0')->build())->build();
     $this->sprint = aMilestone()->withArtifact(aMockArtifact()->withId(3)->withTitle('Sprint 1')->build())->build();
     $this->nomilestone = stub('Planning_NoMilestone')->getPlanning()->returns(mock('Planning'));
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     $this->project_manager = mock('ProjectManager');
     $this->current_user = aUser()->build();
     $this->request = aRequest()->withUser($this->current_user)->with('group_id', 102)->build();
     $this->project = mock('Project');
     stub($this->project_manager)->getProject(102)->returns($this->project);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:17,代码来源:MilestoneControllerTest.php

示例13: itLinksWithAllHierarchyWhenItWasLinkedToAnAssociatedTracker

 public function itLinksWithAllHierarchyWhenItWasLinkedToAnAssociatedTracker()
 {
     $user = aUser()->build();
     $epic_id = 2;
     $epic = aMockArtifact()->withId(2)->build();
     stub($epic)->getAllAncestors($user)->returns(array());
     $product = aMockArtifact()->withId(56)->build();
     $release_id = 7777;
     $release = aMockArtifact()->withId($release_id)->build();
     stub($release)->getAllAncestors($user)->returns(array($product));
     $request = aRequest()->with('link-artifact-id', "{$release_id}")->withUser($user)->build();
     $epic->expectNever('linkArtifact');
     $release->expectNever('linkArtifact');
     $product->expectOnce('linkArtifact', array($epic_id, $user));
     $artifact_factory = mock('Tracker_ArtifactFactory');
     stub($artifact_factory)->getArtifactById($release_id)->returns($release);
     $linker = new Planning_ArtifactLinker($artifact_factory);
     $linker->linkWithParents($request, $epic);
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:19,代码来源:ArtifactLinkerTest.php

示例14: itCreatesAnArtifactNodeForEveryArtifactId

 public function itCreatesAnArtifactNodeForEveryArtifactId()
 {
     $provider = new Cardwall_ArtifactNodeTreeProvider();
     $artifact_factory = mock('Tracker_ArtifactFactory');
     $artifact4 = aMockArtifact()->withId(4)->build();
     $artifact5 = aMockArtifact()->withId(5)->build();
     $artifact6 = aMockArtifact()->withId(6)->build();
     stub($artifact_factory)->getArtifactById(4)->returns($artifact4);
     stub($artifact_factory)->getArtifactById(5)->returns($artifact5);
     stub($artifact_factory)->getArtifactById(6)->returns($artifact6);
     $cards = $provider->getCards(array(4, 5, 6), $artifact_factory);
     $this->assertEqual(3, count($cards));
     foreach ($cards as $card) {
         $id = $card->getId();
         $this->assertBetweenClosedInterval($id, 4, 6);
         $artifact = $card->getArtifact();
         $this->assertBetweenClosedInterval($artifact->getId(), 4, 6);
         $this->assertIsA($artifact, 'Tracker_Artifact');
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:20,代码来源:ArtifactNodeTreeProviderTest.php

示例15: itReturnsJson

 public function itReturnsJson()
 {
     $artifact_id = 55;
     $artifact_title = 'bla';
     $cross_ref = 'task #22';
     $edit_url = 'edit';
     $accent_color = 'rgb(12,12,12)';
     $swimline_id = 215;
     $drop_into = array('5', '7');
     $artifact = aMockArtifact()->withId($artifact_id)->build();
     $card_fields = mock('Cardwall_CardFields');
     $field1 = mock('Tracker_FormElement_Field_Float');
     $field2 = mock('Tracker_FormElement_Field_Selectbox');
     $field3 = mock('Tracker_FormElement_Field_Selectbox');
     stub($field1)->getJsonValue()->returns(5.1);
     stub($field2)->getJsonValue()->returns(array(101, 201));
     stub($field3)->getJsonValue()->returns(236);
     stub($field1)->fetchCardValue()->returns("5.1");
     stub($field2)->fetchCardValue()->returns('<a href');
     stub($field3)->fetchCardValue()->returns('<span>Decorator</span>');
     stub($field1)->getName()->returns(Tracker::REMAINING_EFFORT_FIELD_NAME);
     stub($field2)->getName()->returns(Tracker::ASSIGNED_TO_FIELD_NAME);
     stub($field3)->getName()->returns(Tracker::IMPEDIMENT_FIELD_NAME);
     $card_presenter = mock('Cardwall_CardPresenter');
     stub($card_presenter)->getTitle()->returns($artifact_title);
     stub($card_presenter)->getXRef()->returns($cross_ref);
     stub($card_presenter)->getEditUrl()->returns($edit_url);
     stub($card_presenter)->getAccentColor()->returns($accent_color);
     stub($card_presenter)->getSwimlineId()->returns($swimline_id);
     $card_in_cell_presenter = mock('Cardwall_CardInCellPresenter');
     stub($card_in_cell_presenter)->getCardPresenter()->returns($card_presenter);
     stub($card_in_cell_presenter)->getDropIntoIds()->returns($drop_into);
     stub($card_in_cell_presenter)->getArtifact()->returns($artifact);
     stub($card_fields)->getFields()->returns(array($field1, $field2, $field3));
     $single_card = new Cardwall_SingleCard($card_in_cell_presenter, $card_fields, mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 1111, mock('Cardwall_OnTop_Config_TrackerMapping'));
     $card_controller = new Cardwall_CardController(aRequest()->withUser(mock('PFUser'))->build(), $single_card);
     $expected = array($artifact_id => array('title' => $artifact_title, 'xref' => $cross_ref, 'edit_url' => $edit_url, 'accent_color' => $accent_color, 'column_id' => 1111, 'drop_into' => $drop_into, 'fields' => array('remaining_effort' => 5.1, 'assigned_to' => array(101, 201), 'impediment' => 236), 'html_fields' => array('remaining_effort' => '5.1', 'assigned_to' => '<a href', 'impediment' => '<span>Decorator</span>')));
     expect($GLOBALS['Response'])->sendJSON($expected)->once();
     $card_controller->getCard();
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:40,代码来源:CardControllerTest.php


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