mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
fix: tests in Helpers directory are not executed
This commit is contained in:
@ -30,7 +30,10 @@ final class Backtrace
|
||||
|
||||
$traceFile = str_replace(DIRECTORY_SEPARATOR, '/', $trace[self::FILE]);
|
||||
|
||||
if (Str::endsWith($traceFile, 'overrides/Runner/TestSuiteLoader.php')) {
|
||||
if (
|
||||
Str::endsWith($traceFile, 'overrides/Runner/TestSuiteLoader.php') ||
|
||||
Str::endsWith($traceFile, 'src/Bootstrappers/BootFiles.php')
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
⨯.
|
||||
.⨯.
|
||||
────────────────────────────────────────────────────────────────────────────
|
||||
FAILED Tests\Fixtures\CollisionTest > error Exception
|
||||
error
|
||||
@ -19,4 +19,4 @@
|
||||
2 src/Factories/TestCaseMethodFactory.php:100
|
||||
|
||||
|
||||
Tests: 1 failed, 1 passed (1 assertions)
|
||||
Tests: 1 failed, 2 passed (2 assertions)
|
||||
@ -673,6 +673,7 @@
|
||||
✓ it throws error if method do not exist
|
||||
✓ it can forward unexpected calls to any global function
|
||||
✓ it can use helpers from helpers file
|
||||
✓ it can use helpers from helpers directory
|
||||
|
||||
PASS Tests\Features\HigherOrderTests
|
||||
✓ it proxies calls to object
|
||||
@ -789,6 +790,9 @@
|
||||
PASS Tests\Fixtures\ExampleTest
|
||||
✓ it example 2
|
||||
|
||||
PASS Tests\Helpers\TestInHelpers
|
||||
✓ it executes tests in the Helpers directory
|
||||
|
||||
PASS Tests\Hooks\AfterAllTest
|
||||
✓ global afterAll execution order
|
||||
✓ it only gets called once per file
|
||||
@ -1009,4 +1013,4 @@
|
||||
PASS Tests\Visual\Version
|
||||
✓ visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 706 passed (1707 assertions)
|
||||
Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 708 passed (1709 assertions)
|
||||
@ -44,3 +44,5 @@ it('throws error if method do not exist', function () {
|
||||
it('can forward unexpected calls to any global function')->_assertThat();
|
||||
|
||||
it('can use helpers from helpers file')->myAssertTrue(true);
|
||||
|
||||
it('can use helpers from helpers directory')->myDirectoryAssertTrue(true);
|
||||
|
||||
6
tests/Helpers/Helper.php
Normal file
6
tests/Helpers/Helper.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
function myDirectoryAssertTrue($value)
|
||||
{
|
||||
test()->assertTrue($value);
|
||||
}
|
||||
5
tests/Helpers/TestInHelpers.php
Normal file
5
tests/Helpers/TestInHelpers.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
it('executes tests in the Helpers directory', function () {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
@ -18,10 +18,10 @@ $run = function () {
|
||||
|
||||
test('parallel', function () use ($run) {
|
||||
expect($run('--exclude-group=integration'))
|
||||
->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 694 passed (1692 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 696 passed (1694 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||
|
||||
test('a parallel test can extend another test with same name', function () use ($run) {
|
||||
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 1 passed (1 assertions)');
|
||||
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 2 passed (2 assertions)');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user