'draft',
'published',
],
array_keys($workflow->
getTypePlugin()->
getConfiguration()['states'
]));
// Ensure we're returning state objects.
$this->
assertInstanceOf(State::
class,
$workflow->
getTypePlugin()->
getStates()['draft'
]);
// Passing in no IDs returns all states.
$this->
assertEquals(['draft', 'published', 'archived'
],
array_keys($workflow->
getTypePlugin()->
getStates()));
// The order of states is by weight.
$workflow->
getTypePlugin()->
setStateWeight('published', -1
);
$this->
assertEquals(['published', 'draft', 'archived'
],
array_keys($workflow->
getTypePlugin()->
getStates()));
// The label is also used for sorting if weights are equal.
$workflow->
getTypePlugin()->
setStateWeight('archived', 0
);
$this->
assertEquals(['published', 'archived', 'draft'
],
array_keys($workflow->
getTypePlugin()->
getStates()));
// You can limit the states returned by passing in states IDs.
$this->
assertEquals(['archived', 'draft'
],
array_keys($workflow->
getTypePlugin()->
getStates(['draft', 'archived'
])));
// An empty array does not load all states.
$this->
assertSame([],
$workflow->
getTypePlugin()->
getStates([]));
}