-
-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathTestAsyncWorkflow.php
More file actions
33 lines (24 loc) · 820 Bytes
/
TestAsyncWorkflow.php
File metadata and controls
33 lines (24 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
namespace Tests\Fixtures;
use AssertionError;
use Illuminate\Contracts\Foundation\Application;
use Workflow\Workflow;
use function Workflow\{activity, async};
final class TestAsyncWorkflow extends Workflow
{
public function execute()
{
$results = yield async(static function (Application $app) {
if (! $app->runningInConsole()) {
throw new AssertionError('Test workflows must run in console.');
}
$otherResult = yield activity(TestOtherActivity::class, 'other');
$result = yield activity(TestActivity::class);
return [$otherResult, $result];
});
$otherResult = $results[0];
$result = $results[1];
return 'workflow_' . $result . '_' . $otherResult;
}
}