Skip to content

Commit

Permalink
Add test; fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Apr 9, 2024
1 parent 2c4bf07 commit b575ab3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Internal/Client/WorkflowStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ function (DescribeInput $input): WorkflowExecutionDescription {
$response = $this->serviceClient->DescribeWorkflowExecution($request);
$mapper = new WorkflowExecutionInfoMapper($this->converter);

/** @psalm-suppress PossiblyNullArgument */
return new WorkflowExecutionDescription(
info: $mapper->fromMessage($response->getWorkflowExecutionInfo()),
);
Expand Down
26 changes: 26 additions & 0 deletions tests/Functional/Client/UntypedWorkflowStubTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Temporal\Exception\IllegalStateException;
use Temporal\Exception\InvalidArgumentException;
use Temporal\Tests\Unit\Declaration\Fixture\WorkflowWithoutHandler;
use Temporal\Workflow\WorkflowExecutionStatus;

/**
* @group client
Expand Down Expand Up @@ -212,6 +213,31 @@ public function testTerminated()
}
}

public function testDescribe(): void
{
$client = $this->createClient();
$simple = $client->newUntypedWorkflowStub('SimpleSignalledWorkflowWithSleep');

$e = $client->start($simple, -1);

$stubDescription = $simple->describe();
$runDescription = $e->describe();

self::assertEquals($stubDescription, $runDescription);
self::assertSame(WorkflowExecutionStatus::Running, $runDescription->info->status);

$simple->terminate('user triggered');
// Wait a little bit for the workflow to terminate
\usleep(1000);

$stubDescription = $simple->describe();
$runDescription = $e->describe();

// After termination
self::assertEquals($stubDescription, $runDescription);
self::assertSame(WorkflowExecutionStatus::Terminated, $runDescription->info->status);
}

public function testSignalRunningWorkflowWithInheritedSignal()
{
$client = $this->createClient();
Expand Down

0 comments on commit b575ab3

Please sign in to comment.