diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 2fd68457..8775fb86 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -384,6 +384,34 @@ final class TestCall return $this; } + /** + * Sets the test as "done". + */ + public function done(// @phpstan-ignore-line + array|string|null $note = null, + array|string|null $assignee = null, + array|string|null $issue = null, + array|string|null $pr = null, + ): self { + if ($issue !== null) { + $this->issue($issue); + } + + if ($pr !== null) { + $this->pr($pr); + } + + if ($assignee !== null) { + $this->assignee($assignee); + } + + if ($note !== null) { + $this->note($note); + } + + return $this; + } + /** * Associates the test with the given issue(s). * diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index e3919000..5794d90f 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -224,6 +224,13 @@ ✓ a "describe" group of tests → get 'foo' → get 'bar' → expect true → toBeTrue ✓ a "describe" group of tests → get 'foo' → expect true → toBeTrue + PASS Tests\Features\Done + ✓ it may have an associated assignee [@nunomaduro] + ✓ it may have an associated issue #1 + ✓ it may have an associated PR #1 + ✓ it may have an associated note + // a note + PASS Tests\Features\Exceptions ✓ it gives access the the underlying expectException ✓ it catch exceptions @@ -1559,4 +1566,4 @@ WARN Tests\Visual\Version - visual snapshot of help command output - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1084 passed (2644 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1088 passed (2648 assertions) \ No newline at end of file diff --git a/tests/Features/Done.php b/tests/Features/Done.php new file mode 100644 index 00000000..bee3450d --- /dev/null +++ b/tests/Features/Done.php @@ -0,0 +1,17 @@ +toBeTrue(); +})->done(assignee: 'nunomaduro'); + +it('may have an associated issue', function () { + expect(true)->toBeTrue(); +})->done(issue: 1); + +it('may have an associated PR', function () { + expect(true)->toBeTrue(); +})->done(pr: 1); + +it('may have an associated note', function () { + expect(true)->toBeTrue(); +})->done(note: 'a note'); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 8a15a191..aad9adcf 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -16,7 +16,7 @@ $run = function () { test('parallel', function () use ($run) { expect($run('--exclude-group=integration')) - ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1070 passed (2612 assertions)') + ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1074 passed (2616 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows();