diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 50b041c6..693434b4 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -355,12 +355,32 @@ final class TestCall /** * Sets the test as "todo". */ - public function todo(): self - { + public function todo( + array|string $issue = null, + array|string $pr = null, + array|string $assignee = null, + array|string $note = null, + ): self { $this->skip('__TODO__'); $this->testCaseMethod->todo = true; + 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; } diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index f868a173..6c685f40 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -1251,11 +1251,16 @@ ✓ nested → it may be associated with an ticket #1, #4, #5, #6, #3 // an note between an the ticket - PASS Tests\Features\Todo - 3 todos + PASS Tests\Features\Todo - 7 todos ↓ something todo later ↓ something todo later chained ↓ something todo later chained and with function body ✓ it does something within a file with a todo + ↓ 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 WARN Tests\Features\Warnings ! warning → Undefined property: P\Tests\Features\Warnings::$fooqwdfwqdfqw @@ -1542,4 +1547,4 @@ WARN Tests\Visual\Version - visual snapshot of help command output - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1078 passed (2632 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1078 passed (2632 assertions) \ No newline at end of file diff --git a/tests/.snapshots/todo.txt b/tests/.snapshots/todo.txt index 414d1b98..25f6eeb9 100644 --- a/tests/.snapshots/todo.txt +++ b/tests/.snapshots/todo.txt @@ -1,3 +1,4 @@ + TODO Tests\Features\BeforeEachProxiesToTestCallWithTodo - 4 todos ↓ is marked as todo 1 ↓ is marked as todo 2 @@ -14,10 +15,15 @@ ↓ todo on describe → should not fail ↓ todo on describe → should run - TODO Tests\Features\Todo - 3 todos + TODO Tests\Features\Todo - 7 todos ↓ something todo later ↓ something todo later chained ↓ something todo later chained and with function body + ↓ 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\CustomTestCase\ChildTest ✓ override method @@ -28,4 +34,4 @@ PASS Tests\CustomTestCase\ParentTest ✓ override method - Tests: 13 todos, 3 passed (3 assertions) + Tests: 17 todos, 3 passed (3 assertions) diff --git a/tests/.snapshots/todos.txt b/tests/.snapshots/todos.txt index 414d1b98..25f6eeb9 100644 --- a/tests/.snapshots/todos.txt +++ b/tests/.snapshots/todos.txt @@ -1,3 +1,4 @@ + TODO Tests\Features\BeforeEachProxiesToTestCallWithTodo - 4 todos ↓ is marked as todo 1 ↓ is marked as todo 2 @@ -14,10 +15,15 @@ ↓ todo on describe → should not fail ↓ todo on describe → should run - TODO Tests\Features\Todo - 3 todos + TODO Tests\Features\Todo - 7 todos ↓ something todo later ↓ something todo later chained ↓ something todo later chained and with function body + ↓ 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\CustomTestCase\ChildTest ✓ override method @@ -28,4 +34,4 @@ PASS Tests\CustomTestCase\ParentTest ✓ override method - Tests: 13 todos, 3 passed (3 assertions) + Tests: 17 todos, 3 passed (3 assertions) diff --git a/tests/Features/Todo.php b/tests/Features/Todo.php index 6086b77c..39f79e44 100644 --- a/tests/Features/Todo.php +++ b/tests/Features/Todo.php @@ -11,3 +11,19 @@ test('something todo later chained and with function body', function () { it('does something within a file with a todo', function () { expect(true)->toBeTrue(); }); + +it('may have an associated assignee', function () { + expect(true)->toBeTrue(); +})->todo(assignee: 'nunomaduro'); + +it('may have an associated issue', function () { + expect(true)->toBeTrue(); +})->todo(issue: 1); + +it('may have an associated PR', function () { + expect(true)->toBeTrue(); +})->todo(pr: 1); + +it('may have an associated note', function () { + expect(true)->toBeTrue(); +})->todo(note: 'a note'); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index a6bbb0d3..6514fd47 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, 13 todos, 19 skipped, 1064 passed (2600 assertions)') + ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1064 passed (2600 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows();