Pantheon\Terminus\Models\Workflow::operations PHP Method

operations() public method

Returns a list of WorkflowOperations for this workflow
public operations ( ) : WorkflowOperation[]
return WorkflowOperation[]
    public function operations()
    {
        if (is_array($this->get('operations'))) {
            $operations_data = $this->get('operations');
        } else {
            $operations_data = [];
        }
        $operations = [];
        foreach ($operations_data as $operation_data) {
            $operations[] = $this->getContainer()->get(WorkflowOperation::class, [$operation_data]);
        }
        return $operations;
    }

Usage Example

コード例 #1
0
 public function testOperations()
 {
     $operations = [['id' => 'bar', 'description' => 'Dumbo Drop'], ['id' => 'baz', 'description' => 'Dumbo Pick Back Up Again']];
     $container = $this->getMockBuilder(Container::class)->disableOriginalConstructor()->getMock();
     foreach ($operations as $i => $op) {
         $container->expects($this->at($i))->method('get')->with(WorkflowOperation::class, [$op])->willReturn(new WorkflowOperation($op));
     }
     $this->workflow->setContainer($container);
     $this->workflow->set('operations', $operations);
     $this->workflow->operations();
 }