Compare commits

...

6 Commits

8 changed files with 59 additions and 11 deletions

View File

@ -18,19 +18,19 @@
], ],
"require": { "require": {
"php": "^8.3.0", "php": "^8.3.0",
"brianium/paratest": "^7.19.2", "brianium/paratest": "^7.20.0",
"nunomaduro/collision": "^8.9.1", "nunomaduro/collision": "^8.9.2",
"nunomaduro/termwind": "^2.4.0", "nunomaduro/termwind": "^2.4.0",
"pestphp/pest-plugin": "^4.0.0", "pestphp/pest-plugin": "^4.0.0",
"pestphp/pest-plugin-arch": "^4.0.0", "pestphp/pest-plugin-arch": "^4.0.0",
"pestphp/pest-plugin-mutate": "^4.0.1", "pestphp/pest-plugin-mutate": "^4.0.1",
"pestphp/pest-plugin-profanity": "^4.2.1", "pestphp/pest-plugin-profanity": "^4.2.1",
"phpunit/phpunit": "^12.5.14", "phpunit/phpunit": "^12.5.16",
"symfony/process": "^7.4.5|^8.0.5" "symfony/process": "^7.4.8|^8.0.8"
}, },
"conflict": { "conflict": {
"filp/whoops": "<2.18.3", "filp/whoops": "<2.18.3",
"phpunit/phpunit": ">12.5.14", "phpunit/phpunit": ">12.5.16",
"sebastian/exporter": "<7.0.0", "sebastian/exporter": "<7.0.0",
"webmozart/assert": "<1.11.0" "webmozart/assert": "<1.11.0"
}, },
@ -58,7 +58,7 @@
"pestphp/pest-dev-tools": "^4.1.0", "pestphp/pest-dev-tools": "^4.1.0",
"pestphp/pest-plugin-browser": "^4.3.0", "pestphp/pest-plugin-browser": "^4.3.0",
"pestphp/pest-plugin-type-coverage": "^4.0.3", "pestphp/pest-plugin-type-coverage": "^4.0.3",
"psy/psysh": "^0.12.21" "psy/psysh": "^0.12.22"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string function version(): string
{ {
return '4.4.3'; return '4.4.4';
} }
function testDirectory(string $file = ''): string function testDirectory(string $file = ''): string

View File

@ -56,4 +56,31 @@ trait HandleArguments
return array_values(array_flip($arguments)); return array_values(array_flip($arguments));
} }
/**
* Pops the given argument and its value from the arguments, returning the value.
*
* @param array<int, string> $arguments
*/
public function popArgumentValue(string $argument, array &$arguments): ?string
{
foreach ($arguments as $key => $value) {
if (str_contains($value, "$argument=")) {
unset($arguments[$key]);
$arguments = array_values($arguments);
return substr($value, strlen($argument) + 1);
}
if ($value === $argument && isset($arguments[$key + 1])) {
$result = $arguments[$key + 1];
unset($arguments[$key], $arguments[$key + 1]);
$arguments = array_values($arguments);
return $result;
}
}
return null;
}
} }

View File

@ -107,6 +107,13 @@ final readonly class Help implements HandlesArguments
'desc' => 'Initialise a standard Pest configuration', 'desc' => 'Initialise a standard Pest configuration',
]], ...$content['Configuration']]; ]], ...$content['Configuration']];
$content['AI'] = [
[
'arg' => '--ai',
'desc' => 'Run a code snippet as a fully scaffolded test for AI verification',
],
];
$content['Execution'] = [...[ $content['Execution'] = [...[
[ [
'arg' => '--parallel', 'arg' => '--parallel',

View File

@ -113,6 +113,16 @@ final class TestRepository
$this->testCaseMethodFilters[] = $filter; $this->testCaseMethodFilters[] = $filter;
} }
/**
* Gets the class and traits configured for the given directory path.
*
* @return array<int, string>
*/
public function getUsesForPath(string $path): array
{
return $this->uses[$path][0] ?? [];
}
/** /**
* Gets the test case factory from the given filename. * Gets the test case factory from the given filename.
*/ */

View File

@ -1,5 +1,6 @@
<?php <?php
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase; use Tests\TestCase;
/* /*
@ -14,7 +15,7 @@ use Tests\TestCase;
*/ */
pest()->extend(TestCase::class) pest()->extend(TestCase::class)
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class) // ->use(RefreshDatabase::class)
->in('Feature'); ->in('Feature');
/* /*

View File

@ -1,5 +1,5 @@
Pest Testing Framework 4.4.3. Pest Testing Framework 4.4.4.
USAGE: pest <file> [options] USAGE: pest <file> [options]
@ -92,7 +92,7 @@
--random-order-seed [N] Use the specified random seed when running tests in random order --random-order-seed [N] Use the specified random seed when running tests in random order
REPORTING OPTIONS: REPORTING OPTIONS:
--colors [flag] ......... Use colors in output ("never", "auto" or "always") --colors=[flag] ......... Use colors in output ("never", "auto" or "always")
--columns [n] ................. Number of columns to use for progress output --columns [n] ................. Number of columns to use for progress output
--columns max ............ Use maximum number of columns for progress output --columns max ............ Use maximum number of columns for progress output
--stderr ................................. Write to STDERR instead of STDOUT --stderr ................................. Write to STDERR instead of STDOUT
@ -147,6 +147,9 @@
--disable-coverage-ignore ...... Disable metadata for ignoring code coverage --disable-coverage-ignore ...... Disable metadata for ignoring code coverage
--no-coverage Ignore code coverage reporting configured in the XML configuration file --no-coverage Ignore code coverage reporting configured in the XML configuration file
AI OPTIONS:
--ai ..... Run a code snippet as a fully scaffolded test for AI verification
MUTATION TESTING OPTIONS: MUTATION TESTING OPTIONS:
--mutate .... Runs mutation testing, to understand the quality of your tests --mutate .... Runs mutation testing, to understand the quality of your tests
--mutate --parallel ...................... Runs mutation testing in parallel --mutate --parallel ...................... Runs mutation testing in parallel

View File

@ -1,3 +1,3 @@
Pest Testing Framework 4.4.3. Pest Testing Framework 4.4.4.