|
@@ 209-226 (lines=18) @@
|
| 206 |
|
* |
| 207 |
|
* @throws \RuntimeException |
| 208 |
|
*/ |
| 209 |
|
public function initializeWorkflowEntry($entryAlias, $workflowName, $initialAction) |
| 210 |
|
{ |
| 211 |
|
$entryAlias = (string)$entryAlias; |
| 212 |
|
if (array_key_exists($entryAlias, $this->entryAliasToEntryId)) { |
| 213 |
|
$errMsg = sprintf('Alias %s already exists', $entryAlias); |
| 214 |
|
throw new \RuntimeException($errMsg); |
| 215 |
|
} |
| 216 |
|
|
| 217 |
|
$workflowManager = $this->getWorkflowManager(); |
| 218 |
|
|
| 219 |
|
try { |
| 220 |
|
$entryId = $workflowManager->initialize($workflowName, $initialAction, $this->transientVars); |
| 221 |
|
$this->entryAliasToEntryId[$entryAlias] = $entryId; |
| 222 |
|
} catch (\Exception $e) { |
| 223 |
|
$this->lastException = $e; |
| 224 |
|
//throw new \RuntimeException($e->getMessage(), $e->getCode(), $e); |
| 225 |
|
} |
| 226 |
|
} |
| 227 |
|
|
| 228 |
|
/** |
| 229 |
|
* @When Call action with id=:actionId for workflow process with alias :entryAlias |
|
@@ 236-253 (lines=18) @@
|
| 233 |
|
* |
| 234 |
|
* @throws \RuntimeException |
| 235 |
|
*/ |
| 236 |
|
public function callActionWithIdForWorkflowProcessWithAlias($entryAlias, $actionId) |
| 237 |
|
{ |
| 238 |
|
$entryAlias = (string)$entryAlias; |
| 239 |
|
if (!array_key_exists($entryAlias, $this->entryAliasToEntryId)) { |
| 240 |
|
$errMsg = sprintf('Alias %s not exists', $entryAlias); |
| 241 |
|
throw new \RuntimeException($errMsg); |
| 242 |
|
} |
| 243 |
|
$entryId = $this->entryAliasToEntryId[$entryAlias]; |
| 244 |
|
|
| 245 |
|
$workflowManager = $this->getWorkflowManager(); |
| 246 |
|
|
| 247 |
|
try { |
| 248 |
|
$workflowManager->doAction($entryId, $actionId, $this->transientVars); |
| 249 |
|
} catch (\Exception $e) { |
| 250 |
|
$this->lastException = $e; |
| 251 |
|
//throw new \RuntimeException($e->getMessage(), $e->getCode(), $e); |
| 252 |
|
} |
| 253 |
|
} |
| 254 |
|
|
| 255 |
|
/** |
| 256 |
|
* @Then Last action was the result of class exception :exceptionClassName. The massage of exception: :exceptionText |