本文整理汇总了PHP中Workflow::getTransitions方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::getTransitions方法的具体用法?PHP Workflow::getTransitions怎么用?PHP Workflow::getTransitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::getTransitions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWorkflowRepresentation
/**
* @param PFUser $user
* @return Tuleap\Tracker\REST\WorkflowRepresentation | null
*/
private function getWorkflowRepresentation(Workflow $workflow, PFUser $user, $project_id)
{
if (!$workflow->isUsed() || !$workflow->getField()->userCanRead($user)) {
return;
}
$transitions = array();
foreach ($workflow->getTransitions() as $transition) {
$condition_permission = new Workflow_Transition_Condition_Permissions($transition);
if ($condition_permission->isUserAllowedToSeeTransition($user, $project_id)) {
$transitions[] = $this->getWorkflowTransitionRepresentation($transition);
}
}
$workflow_representation = new WorkflowRepresentation();
$workflow_representation->build($workflow->getFieldId(), $workflow->getIsUsed(), $this->getWorkflowRulesRepresentation($workflow), $transitions);
return $workflow_representation;
}
示例2: saveObject
/**
* Creates new workflow in the database
*
* @param Workflow $workflow The workflow to save
* @param Tracker $tracker The tracker
*
* @return void
*/
public function saveObject($workflow, $tracker)
{
$workflow->setTracker($tracker);
$dao = $this->getDao();
$workflow_id = $dao->save($workflow->tracker_id, $workflow->getField()->getId(), $workflow->is_used);
//Save transitions
foreach ($workflow->getTransitions() as $transition) {
$tf = $this->transition_factory;
$tf->saveObject($workflow_id, $transition);
}
}
示例3: testUseCaseBug
public function testUseCaseBug()
{
$field_value_new = new MockTracker_FormElement_Field_List_Value();
$field_value_new->setReturnValue('getId', 2066);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'New',
//'description' => 'The bug has been submitted',
//'rank' => '10');
$field_value_analyzed = new MockTracker_FormElement_Field_List_Value();
$field_value_analyzed->setReturnValue('getId', 2067);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'Analyzed',
//'description' => 'The bug is analyzed',
//'rank' => '20');
$field_value_accepted = new MockTracker_FormElement_Field_List_Value();
$field_value_accepted->setReturnValue('getId', 2068);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'Accepted',
//'description' => 'The bug is accepted',
//'rank' => '30');
$field_value_rejected = new MockTracker_FormElement_Field_List_Value();
$field_value_rejected->setReturnValue('getId', 2069);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'Rejected',
//'description' => 'The bug is rejected',
//'rank' => '40');
$field_value_fixed = new MockTracker_FormElement_Field_List_Value();
$field_value_fixed->setReturnValue('getId', 2070);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'Fixed',
//'description' => 'The bug was resolved',
//'rank' => '50');
$field_value_tested = new MockTracker_FormElement_Field_List_Value();
$field_value_tested->setReturnValue('getId', 2071);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'Tested',
//'description' => 'The bug is tested',
//'rank' => '60');
$field_value_deployed = new MockTracker_FormElement_Field_List_Value();
$field_value_deployed->setReturnValue('getId', 2072);
//'old_id' => null,
//'field_id' => 2707,
//'value' => 'Deployed',
//'description' => 'The bug is deployed',
//'rank' => '70');
$t_new_analyzed = new Transition(1, 2, $field_value_new, $field_value_analyzed);
$t_analyzed_accepted = new Transition(1, 2, $field_value_analyzed, $field_value_accepted);
$t_analyzed_rejected = new Transition(1, 2, $field_value_analyzed, $field_value_rejected);
$t_accepted_fixed = new Transition(1, 2, $field_value_accepted, $field_value_fixed);
$t_fixed_tested = new Transition(1, 2, $field_value_fixed, $field_value_tested);
$t_tested_deployed = new Transition(1, 2, $field_value_tested, $field_value_deployed);
$transitions = array($t_new_analyzed, $t_analyzed_accepted, $t_analyzed_rejected, $t_accepted_fixed, $t_fixed_tested, $t_tested_deployed);
$workflow = new Workflow(1, 2, 3, 1, $transitions);
$this->assertNotNull($workflow->getTransitions());
$this->assertTrue($workflow->hasTransitions());
// Test existing transition
$this->assertTrue($workflow->isTransitionExist($field_value_new, $field_value_analyzed));
$this->assertTrue($workflow->isTransitionExist($field_value_analyzed, $field_value_accepted));
$this->assertTrue($workflow->isTransitionExist($field_value_analyzed, $field_value_rejected));
$this->assertTrue($workflow->isTransitionExist($field_value_accepted, $field_value_fixed));
$this->assertTrue($workflow->isTransitionExist($field_value_fixed, $field_value_tested));
$this->assertTrue($workflow->isTransitionExist($field_value_tested, $field_value_deployed));
$this->assertFalse($workflow->isTransitionExist($field_value_new, $field_value_tested));
$this->assertFalse($workflow->isTransitionExist($field_value_new, $field_value_rejected));
$this->assertFalse($workflow->isTransitionExist($field_value_analyzed, $field_value_new));
$this->assertFalse($workflow->isTransitionExist($field_value_accepted, $field_value_rejected));
}