Skip to content

Commit 0b398d8

Browse files
committed
test: add assertions for trailed runLocked behavior
1 parent 1540624 commit 0b398d8

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

tests/Acceptance/Extra/Workflow/MutexRunLockedTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function runLockedWithGeneratorAndAwait(
3030
$this->assertTrue($result[1], 'The function inside runLocked mist wait for signal');
3131
$this->assertTrue($result[2], 'Mutex must be locked during runLocked');
3232
$this->assertNull($result[3], 'No exception must be thrown');
33+
$this->assertFalse($result[4], 'The trailed runLocked must not run: the permanent lock is held');
3334
}
3435

3536
#[Test]
@@ -44,6 +45,7 @@ public function runLockedAndCancel(
4445
$this->assertTrue($result[0], 'Mutex must be unlocked after runLocked is cancelled');
4546
$this->assertNull($result[2], 'Mutex must be locked during runLocked');
4647
$this->assertSame(CanceledFailure::class, $result[3], 'CanceledFailure must be thrown');
48+
$this->assertTrue($result[4], 'Cancelling the outer runLocked releases the inner permanent lock, so the trailed runLocked runs');
4749
}
4850
}
4951

@@ -82,11 +84,7 @@ public function handle(): \Generator
8284
}),
8385
);
8486

85-
// The last runLocked must not be executed because there a permanent lock
86-
// that was created inside the first runLocked
87-
$trailed and throw new \Exception('The trailed runLocked must not be executed.');
88-
89-
return [$this->unlocked, $this->unblock, $result, $exception];
87+
return [$this->unlocked, $this->unblock, $result, $exception, $trailed];
9088
}
9189

9290
#[Workflow\SignalMethod]

0 commit comments

Comments
 (0)