mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Allows to set context on todos
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1078 passed (2632 assertions)
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user