mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat(container): makes it autowirable
Co-Authored-By: Johannes Pichler <fetzi@users.noreply.github.com>
This commit is contained in:
@ -70,7 +70,7 @@
|
|||||||
"test:types": "phpstan analyse --ansi",
|
"test:types": "phpstan analyse --ansi",
|
||||||
"test:unit": "php bin/pest --colors=always --exclude-group=integration",
|
"test:unit": "php bin/pest --colors=always --exclude-group=integration",
|
||||||
"test:integration": "php bin/pest --colors=always --group=integration",
|
"test:integration": "php bin/pest --colors=always --group=integration",
|
||||||
"test:integration:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always",
|
"test:update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always",
|
||||||
"test": [
|
"test": [
|
||||||
"@test:lint",
|
"@test:lint",
|
||||||
"@test:types",
|
"@test:types",
|
||||||
|
|||||||
60
tests/.snapshots/coverage.txt
Normal file
60
tests/.snapshots/coverage.txt
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
|
||||||
|
PASS Tests\Playground
|
||||||
|
✓ basic
|
||||||
|
|
||||||
|
Tests: 1 passed
|
||||||
|
Time: 0.20s
|
||||||
|
Cov: 6.49%
|
||||||
|
|
||||||
|
Actions/AddsDefaults ........................................... 0.0 %
|
||||||
|
Actions/AddsTests .............................................. 0.0 %
|
||||||
|
Actions/LoadStructure .......................................... 0.0 %
|
||||||
|
Actions/ValidatesConfiguration ................................. 0.0 %
|
||||||
|
Actions/ValidatesEnvironment ................................... 0.0 %
|
||||||
|
Concerns/TestCase 40..54, 71..88, 123..126, 147 ............... 44.4 %
|
||||||
|
Console/Command ................................................ 0.0 %
|
||||||
|
Contracts/HasPrintableTestCaseName ............................. 0.0 %
|
||||||
|
Contracts/Plugins/AddsOutput ................................ 100.0 %
|
||||||
|
Contracts/Plugins/HandlesArguments .......................... 100.0 %
|
||||||
|
Datasets ....................................................... 0.0 %
|
||||||
|
Exceptions/AfterAllAlreadyExist ................................ 0.0 %
|
||||||
|
Exceptions/AfterEachAlreadyExist ............................... 0.0 %
|
||||||
|
Exceptions/AttributeNotSupportedYet ............................ 0.0 %
|
||||||
|
Exceptions/BeforeEachAlreadyExist .............................. 0.0 %
|
||||||
|
Exceptions/DatasetAlreadyExist ................................. 0.0 %
|
||||||
|
Exceptions/DatasetDoesNotExist ................................. 0.0 %
|
||||||
|
Exceptions/FileOrFolderNotFound ................................ 0.0 %
|
||||||
|
Exceptions/InvalidConsoleArgument .............................. 0.0 %
|
||||||
|
Exceptions/InvalidPestCommand .................................. 0.0 %
|
||||||
|
Exceptions/InvalidUsesPath ..................................... 0.0 %
|
||||||
|
Exceptions/ShouldNotHappen ..................................... 0.0 %
|
||||||
|
Exceptions/TestAlreadyExist .................................... 0.0 %
|
||||||
|
Exceptions/TestCaseAlreadyInUse ................................ 0.0 %
|
||||||
|
Exceptions/TestCaseClassOrTraitNotFound ........................ 0.0 %
|
||||||
|
Factories/TestCaseFactory 111..133, 141..204 ................... 8.2 %
|
||||||
|
Laravel/Commands/PestDatasetCommand ............................ 0.0 %
|
||||||
|
Laravel/Commands/PestInstallCommand ............................ 0.0 %
|
||||||
|
Laravel/Commands/PestTestCommand ............................... 0.0 %
|
||||||
|
Laravel/PestServiceProvider .................................... 0.0 %
|
||||||
|
PendingObjects/AfterEachCall ................................... 0.0 %
|
||||||
|
PendingObjects/BeforeEachCall .................................. 0.0 %
|
||||||
|
PendingObjects/TestCall ........................................ 0.0 %
|
||||||
|
PendingObjects/UsesCall ........................................ 0.0 %
|
||||||
|
Plugin ......................................................... 0.0 %
|
||||||
|
Repositories/AfterAllRepository ................................ 0.0 %
|
||||||
|
Repositories/AfterEachRepository 28..33 ....................... 60.0 %
|
||||||
|
Repositories/BeforeAllRepository ............................... 0.0 %
|
||||||
|
Repositories/BeforeEachRepository 26..31 ...................... 20.0 %
|
||||||
|
Repositories/TestRepository .................................... 0.0 %
|
||||||
|
Support/Backtrace .............................................. 0.0 %
|
||||||
|
Support/ChainableClosure .................................... 100.0 %
|
||||||
|
Support/Container .............................................. 0.0 %
|
||||||
|
Support/ExceptionTrace 25..32 ................................. 28.6 %
|
||||||
|
Support/HigherOrderMessage ..................................... 0.0 %
|
||||||
|
Support/HigherOrderMessageCollection 24..25, 33, 43 ........... 50.0 %
|
||||||
|
Support/HigherOrderTapProxy .................................... 0.0 %
|
||||||
|
Support/NullClosure ......................................... 100.0 %
|
||||||
|
Support/Reflection ............................................. 0.0 %
|
||||||
|
Support/Str .................................................... 0.0 %
|
||||||
|
TestSuite 80..87, 95..101, 105 ................................ 20.0 %
|
||||||
|
globals ........................................................ 0.0 %
|
||||||
@ -121,10 +121,10 @@
|
|||||||
PASS Tests\Unit\Support\Container
|
PASS Tests\Unit\Support\Container
|
||||||
✓ it exists
|
✓ it exists
|
||||||
✓ it gets an instance
|
✓ it gets an instance
|
||||||
|
✓ autowire
|
||||||
✓ it creates an instance and resolves parameters
|
✓ it creates an instance and resolves parameters
|
||||||
✓ it creates an instance and resolves also sub parameters
|
✓ it creates an instance and resolves also sub parameters
|
||||||
✓ it can resolve builtin value types
|
✓ it can resolve builtin value types
|
||||||
✓ it cannot resolve a parameter that requires additional dependencies
|
|
||||||
✓ it cannot resolve a parameter without type
|
✓ it cannot resolve a parameter without type
|
||||||
|
|
||||||
PASS Tests\Unit\Support\Reflection
|
PASS Tests\Unit\Support\Reflection
|
||||||
@ -134,6 +134,9 @@
|
|||||||
PASS Tests\Unit\TestSuite
|
PASS Tests\Unit\TestSuite
|
||||||
✓ it does not allow to add the same test description twice
|
✓ it does not allow to add the same test description twice
|
||||||
|
|
||||||
|
PASS Tests\Visual\Coverage
|
||||||
|
✓ coverage
|
||||||
|
|
||||||
PASS Tests\Visual\SingleTestOrDirectory
|
PASS Tests\Visual\SingleTestOrDirectory
|
||||||
✓ allows to run a single test
|
✓ allows to run a single test
|
||||||
✓ allows to run a directory
|
✓ allows to run a directory
|
||||||
@ -143,5 +146,5 @@
|
|||||||
WARN Tests\Visual\Success
|
WARN Tests\Visual\Success
|
||||||
s visual snapshot of test suite on success
|
s visual snapshot of test suite on success
|
||||||
|
|
||||||
Tests: 6 skipped, 78 passed
|
Tests: 6 skipped, 79 passed
|
||||||
Time: 3.40s
|
Time: 3.91s
|
||||||
|
|||||||
30
tests/Visual/Coverage.php
Normal file
30
tests/Visual/Coverage.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
|
$run = function (string $target) {
|
||||||
|
$process = new Process(['php', 'bin/pest', $target, '--coverage'], dirname(__DIR__, 2));
|
||||||
|
|
||||||
|
$process->run();
|
||||||
|
|
||||||
|
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
|
||||||
|
};
|
||||||
|
|
||||||
|
$snapshot = function ($name) {
|
||||||
|
$testsPath = dirname(__DIR__);
|
||||||
|
|
||||||
|
return file_get_contents(implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$testsPath,
|
||||||
|
'.snapshots',
|
||||||
|
"$name.txt",
|
||||||
|
]));
|
||||||
|
};
|
||||||
|
|
||||||
|
test('coverage', function () use ($run, $snapshot) {
|
||||||
|
$text = $run('tests/Playground.php');
|
||||||
|
|
||||||
|
assertStringContainsString(
|
||||||
|
$snapshot('coverage'),
|
||||||
|
$run('tests/Playground.php')
|
||||||
|
);
|
||||||
|
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||||
Reference in New Issue
Block a user