mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: adds pest function
This commit is contained in:
@ -1272,6 +1272,12 @@
|
||||
✓ it allows global uses
|
||||
✓ it allows multiple global uses registered in the same path
|
||||
|
||||
PASS Tests\Unit\Configuration\In
|
||||
✓ it proxies to uses call
|
||||
|
||||
PASS Tests\Unit\Configuration\Theme
|
||||
✓ it creates a theme instance
|
||||
|
||||
PASS Tests\Unit\Console\Help
|
||||
✓ it outputs the help information when --help is used
|
||||
|
||||
@ -1455,4 +1461,4 @@
|
||||
WARN Tests\Visual\Version
|
||||
- visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1040 passed (2561 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1042 passed (2563 assertions)
|
||||
@ -7,20 +7,21 @@ error_reporting(E_ALL);
|
||||
|
||||
$GLOBALS['__PEST_INTERNAL_TEST_SUITE'] = true;
|
||||
|
||||
uses(CustomTestCaseInSubFolder::class)->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder');
|
||||
pest()->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder')->use(CustomTestCaseInSubFolder::class);
|
||||
|
||||
// test case for all the directories inside PHPUnit/GlobPatternTests/SubFolder/
|
||||
uses(CustomTestCase::class)->in('PHPUnit/GlobPatternTests/SubFolder/*/');
|
||||
pest()->in('PHPUnit/GlobPatternTests/SubFolder/*')->extend(CustomTestCase::class);
|
||||
|
||||
// test case for all the files that end with AsPattern.php inside PHPUnit/GlobPatternTests/SubFolder2/
|
||||
uses(CustomTestCase::class)->in('PHPUnit/GlobPatternTests/SubFolder2/*AsPattern.php');
|
||||
pest()->in('PHPUnit/GlobPatternTests/SubFolder2/*AsPattern.php')->use(CustomTestCase::class);
|
||||
|
||||
uses()->group('integration')->in('Visual');
|
||||
pest()->in('Visual')->group('integration');
|
||||
|
||||
// NOTE: global test value container to be mutated and checked across files, as needed
|
||||
$_SERVER['globalHook'] = (object) ['calls' => (object) ['beforeAll' => 0, 'afterAll' => 0]];
|
||||
|
||||
uses()
|
||||
pest()
|
||||
->in('Hooks')
|
||||
->beforeEach(function () {
|
||||
$this->baz = 0;
|
||||
})
|
||||
@ -34,10 +35,9 @@ uses()
|
||||
->afterAll(function () {
|
||||
$_SERVER['globalHook']->afterAll = 0;
|
||||
$_SERVER['globalHook']->calls->afterAll++;
|
||||
})
|
||||
->in('Hooks');
|
||||
});
|
||||
|
||||
uses()
|
||||
pest()->in('Hooks')
|
||||
->beforeEach(function () {
|
||||
expect($this)
|
||||
->toHaveProperty('baz')
|
||||
@ -69,8 +69,7 @@ uses()
|
||||
->toBe(0);
|
||||
|
||||
$_SERVER['globalHook']->afterAll = 1;
|
||||
})
|
||||
->in('Hooks');
|
||||
});
|
||||
|
||||
function helper_returns_string()
|
||||
{
|
||||
|
||||
9
tests/Unit/Configuration/In.php
Normal file
9
tests/Unit/Configuration/In.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Pest\PendingCalls\UsesCall;
|
||||
|
||||
it('proxies to uses call', function () {
|
||||
$in = pest()->in();
|
||||
|
||||
expect($in)->toBeInstanceOf(UsesCall::class);
|
||||
});
|
||||
7
tests/Unit/Configuration/Theme.php
Normal file
7
tests/Unit/Configuration/Theme.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
it('creates a theme instance', function () {
|
||||
$theme = pest()->theme();
|
||||
|
||||
expect($theme)->toBeInstanceOf(Pest\Configuration\Theme::class);
|
||||
});
|
||||
@ -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, 1026 passed (2529 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 1028 passed (2531 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user