Compare commits

...

4 Commits

Author SHA1 Message Date
9797a71dbc feat(ai): allow temporary namesapce 2026-04-03 14:43:28 +01:00
c1a54df233 feat: --ai work in progress 2026-04-03 14:04:20 +01:00
ce05ee9aad release: v4.4.4 2026-04-03 12:00:04 +01:00
3d2ebdb273 bump: dependencies 2026-04-03 11:59:54 +01:00
8 changed files with 62 additions and 10 deletions

View File

@ -18,19 +18,19 @@
],
"require": {
"php": "^8.3.0",
"brianium/paratest": "^7.19.2",
"nunomaduro/collision": "^8.9.1",
"brianium/paratest": "^7.20.0",
"nunomaduro/collision": "^8.9.2",
"nunomaduro/termwind": "^2.4.0",
"pestphp/pest-plugin": "^4.0.0",
"pestphp/pest-plugin-arch": "^4.0.0",
"pestphp/pest-plugin-mutate": "^4.0.1",
"pestphp/pest-plugin-profanity": "^4.2.1",
"phpunit/phpunit": "^12.5.14",
"symfony/process": "^7.4.5|^8.0.5"
"phpunit/phpunit": "^12.5.16",
"symfony/process": "^7.4.8|^8.0.8"
},
"conflict": {
"filp/whoops": "<2.18.3",
"phpunit/phpunit": ">12.5.14",
"phpunit/phpunit": ">12.5.16",
"sebastian/exporter": "<7.0.0",
"webmozart/assert": "<1.11.0"
},

View File

@ -59,6 +59,11 @@ final class TestCaseFactory
Concerns\Expectable::class,
];
/**
* The namespace for the test case, overrides the path-based namespace when set.
*/
public ?string $namespace = null;
/**
* Creates a new Factory instance.
*/
@ -127,7 +132,7 @@ final class TestCaseFactory
$partsFQN = explode('\\', $classFQN);
$className = array_pop($partsFQN);
$namespace = implode('\\', $partsFQN);
$namespace = $this->namespace ?? implode('\\', $partsFQN);
$baseClass = sprintf('\%s', $this->class);
if (trim($className) === '') {

View File

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

View File

@ -56,4 +56,31 @@ trait HandleArguments
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',
]], ...$content['Configuration']];
$content['AI'] = [
[
'arg' => '--ai',
'desc' => 'Run a code snippet as a fully scaffolded test for AI verification',
],
];
$content['Execution'] = [...[
[
'arg' => '--parallel',

View File

@ -113,6 +113,16 @@ final class TestRepository
$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.
*/

View File

@ -1,5 +1,5 @@
Pest Testing Framework 4.4.3.
Pest Testing Framework 4.4.4.
USAGE: pest <file> [options]
@ -92,7 +92,7 @@
--random-order-seed [N] Use the specified random seed when running tests in random order
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 max ............ Use maximum number of columns for progress output
--stderr ................................. Write to STDERR instead of STDOUT
@ -147,6 +147,9 @@
--disable-coverage-ignore ...... Disable metadata for ignoring code coverage
--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:
--mutate .... Runs mutation testing, to understand the quality of your tests
--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.