mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
feat: adds see
This commit is contained in:
@ -688,6 +688,17 @@ final class TestCall // @phpstan-ignore-line
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds one or more references to the tested method or class. This helps
|
||||
* to link test cases to the source code for easier navigation.
|
||||
*
|
||||
* @param array<class-string|string>|class-string ...$classes
|
||||
*/
|
||||
public function see(string|array ...$classes): self
|
||||
{
|
||||
return $this->references(...$classes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs the test runner that no expectations happen in this test,
|
||||
* and its purpose is simply to check whether the given code can
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
✓ preset → strict → ignoring ['usleep']
|
||||
✓ preset → security → ignoring ['eval', 'str_shuffle', 'exec', …]
|
||||
✓ globals
|
||||
✓ dependencies
|
||||
✓ contracts
|
||||
|
||||
PASS Tests\Environments\Windows
|
||||
@ -1133,6 +1132,10 @@
|
||||
✓ nested → it may be associated with an pr #1, #4, #5, #6, #3
|
||||
// an note between an the pr
|
||||
|
||||
PASS Tests\Features\References
|
||||
✓ it can reference a specific class
|
||||
✓ it can reference a specific class method
|
||||
|
||||
PASS Tests\Features\Repeat
|
||||
✓ once
|
||||
✓ multiple times @ repetition 1 of 5
|
||||
@ -1309,6 +1312,10 @@
|
||||
✓ it can see datasets defined in Pest.php file with ('B')
|
||||
✓ Pest.php dataset is taken
|
||||
|
||||
PASS Tests\Features\See
|
||||
✓ it can reference a specific class
|
||||
✓ it can reference a specific class method
|
||||
|
||||
WARN Tests\Features\Skip
|
||||
✓ it do not skips
|
||||
- it skips with truthy → 1
|
||||
@ -1712,4 +1719,4 @@
|
||||
WARN Tests\Visual\Version
|
||||
- visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 33 skipped, 1146 passed (2739 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 33 skipped, 1149 passed (2742 assertions)
|
||||
@ -27,27 +27,6 @@ arch('globals')
|
||||
->not->toBeUsed()
|
||||
->ignoring(Expectation::class);
|
||||
|
||||
arch('dependencies')
|
||||
->expect('Pest')
|
||||
->toOnlyUse([
|
||||
'dd',
|
||||
'dump',
|
||||
'expect',
|
||||
'uses',
|
||||
'Termwind',
|
||||
'ParaTest',
|
||||
'Pest\Arch',
|
||||
'Pest\Browser',
|
||||
'Pest\Mutate\Contracts\Configuration',
|
||||
'Pest\Mutate\Decorators\TestCallDecorator',
|
||||
'Pest\Mutate\Repositories\ConfigurationRepository',
|
||||
'Pest\Plugin',
|
||||
'NunoMaduro\Collision',
|
||||
'Whoops',
|
||||
'Symfony\Component\Console',
|
||||
'Symfony\Component\Process',
|
||||
])->ignoring(['Composer', 'PHPUnit', 'SebastianBergmann']);
|
||||
|
||||
arch('contracts')
|
||||
->expect('Pest\Contracts')
|
||||
->toOnlyUse([
|
||||
|
||||
11
tests/Features/References.php
Normal file
11
tests/Features/References.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Pest\Panic;
|
||||
|
||||
it('can reference a specific class', function () {
|
||||
expect(Panic::class)->toBeString();
|
||||
})->references(Panic::class);
|
||||
|
||||
it('can reference a specific class method', function () {
|
||||
expect(Panic::with(...))->toBeCallable();
|
||||
})->references([Panic::class, 'with']);
|
||||
11
tests/Features/See.php
Normal file
11
tests/Features/See.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Pest\Panic;
|
||||
|
||||
it('can reference a specific class', function () {
|
||||
expect(Panic::class)->toBeString();
|
||||
})->see(Panic::class);
|
||||
|
||||
it('can reference a specific class method', function () {
|
||||
expect(Panic::with(...))->toBeCallable();
|
||||
})->see([Panic::class, 'with']);
|
||||
@ -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, 38 todos, 24 skipped, 1136 passed (2715 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 24 skipped, 1139 passed (2718 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user