Adds done

This commit is contained in:
Nuno Maduro
2024-08-10 14:27:18 +01:00
parent 86f46c2efd
commit ad6dca94fa
4 changed files with 54 additions and 2 deletions

View File

@ -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).
*

View File

@ -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)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1088 passed (2648 assertions)

17
tests/Features/Done.php Normal file
View File

@ -0,0 +1,17 @@
<?php
it('may have an associated assignee', function () {
expect(true)->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');

View File

@ -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();