feat: pr and issue

This commit is contained in:
Nuno Maduro
2024-07-04 00:53:58 +01:00
parent 09ca7a1fd5
commit ee32f25485
26 changed files with 423 additions and 53 deletions

View File

@ -22,6 +22,9 @@
--bail ........................... Stop execution upon first not-passed test
--todos ........................ Output to standard output the list of todos
--notes ......................... Output to standard output tests with notes
--issue ........ Output to standard output tests with the given issue number
--pr .... Output to standard output tests with the given pull request number
--pull-request Output to standard output tests with the given pull request number (alias for --pr)
--retry Run non-passing tests first and stop execution upon first error or failure
--list-suites ................................... List available test suites
--testsuite [name] ......... Only run tests from the specified test suite(s)

View File

@ -991,6 +991,11 @@
✓ it is not incompleted because of test with assertions
… a "describe" group of tests → it is incompleted
PASS Tests\Features\Issue
✓ it may be associated with an issue #1, #2
✓ nested → it may be associated with an issue #1, #4, #5, #6, #3
// an note between an the issue
PASS Tests\Features\It
✓ it is a test
✓ it is a higher order message test
@ -1027,6 +1032,11 @@
! notice → This is a notice description // tests/Features/Notices.php:4
! a "describe" group of tests → notice → This is a notice description // tests/Features/Notices.php:11
PASS Tests\Features\Pr
✓ it may be associated with an pr #2
✓ nested → it may be associated with an pr #3
// an note between an the pr
PASS Tests\Features\Repeat
✓ once
✓ multiple times @ repetition 1 of 5
@ -1212,6 +1222,11 @@
✓ it allows performing no expectations without being risky
✓ a "describe" group of tests → it allows performing no expectations without being risky
PASS Tests\Features\Ticket
✓ it may be associated with an ticket #1, #2
✓ 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
↓ something todo later
↓ something todo later chained
@ -1501,4 +1516,4 @@
WARN Tests\Visual\Version
- visual snapshot of help command output
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1057 passed (2588 assertions)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1063 passed (2602 assertions)

View File

@ -119,7 +119,7 @@ describe('something 2', function () {
$this->count++;
})->after(function () {
expect($this->count)->toBe(4);
expect($this->count)->toBe(6);
$this->count++;
});

15
tests/Features/Issue.php Normal file
View File

@ -0,0 +1,15 @@
<?php
beforeEach(function () {
expect(true)->toBeTrue();
})->issue(1);
it('may be associated with an issue', function () {
expect(true)->toBeTrue();
})->issue(2);
describe('nested', function () {
it('may be associated with an issue', function () {
expect(true)->toBeTrue();
})->issue('#3');
})->issue(4)->note('an note between an the issue')->issue([5, 6]);

15
tests/Features/Pr.php Normal file
View File

@ -0,0 +1,15 @@
<?php
beforeEach(function () {
expect(true)->toBeTrue();
})->pr(1);
it('may be associated with an pr', function () {
expect(true)->toBeTrue();
})->pr(2);
describe('nested', function () {
it('may be associated with an pr', function () {
expect(true)->toBeTrue();
})->pr('#3');
})->pr(4)->note('an note between an the pr')->pr(['#5', 6]);

15
tests/Features/Ticket.php Normal file
View File

@ -0,0 +1,15 @@
<?php
beforeEach(function () {
expect(true)->toBeTrue();
})->ticket(1);
it('may be associated with an ticket', function () {
expect(true)->toBeTrue();
})->ticket(2);
describe('nested', function () {
it('may be associated with an ticket', function () {
expect(true)->toBeTrue();
})->ticket(3);
})->ticket(4)->note('an note between an the ticket')->ticket([5, 6]);

View File

@ -7,6 +7,8 @@ error_reporting(E_ALL);
$GLOBALS['__PEST_INTERNAL_TEST_SUITE'] = true;
pest()->context()->github('pestphp/pest');
pest()->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder')->use(CustomTestCaseInSubFolder::class);
// test case for all the directories inside PHPUnit/GlobPatternTests/SubFolder/

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, 13 todos, 19 skipped, 1043 passed (2556 assertions)')
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 1049 passed (2570 assertions)')
->toContain('Parallel: 3 processes');
})->skipOnWindows();