mirror of
https://github.com/pestphp/pest.git
synced 2026-04-21 22:47:27 +02:00
Compare commits
2 Commits
4a1d8d27b8
...
v4.4.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 9797a71dbc | |||
| c1a54df233 |
@ -26,7 +26,7 @@
|
|||||||
"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.16",
|
"phpunit/phpunit": "^12.5.16",
|
||||||
"symfony/process": "^7.4.5|^8.0.8"
|
"symfony/process": "^7.4.8|^8.0.8"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"filp/whoops": "<2.18.3",
|
"filp/whoops": "<2.18.3",
|
||||||
|
|||||||
@ -59,6 +59,11 @@ final class TestCaseFactory
|
|||||||
Concerns\Expectable::class,
|
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.
|
* Creates a new Factory instance.
|
||||||
*/
|
*/
|
||||||
@ -127,7 +132,7 @@ final class TestCaseFactory
|
|||||||
|
|
||||||
$partsFQN = explode('\\', $classFQN);
|
$partsFQN = explode('\\', $classFQN);
|
||||||
$className = array_pop($partsFQN);
|
$className = array_pop($partsFQN);
|
||||||
$namespace = implode('\\', $partsFQN);
|
$namespace = $this->namespace ?? implode('\\', $partsFQN);
|
||||||
$baseClass = sprintf('\%s', $this->class);
|
$baseClass = sprintf('\%s', $this->class);
|
||||||
|
|
||||||
if (trim($className) === '') {
|
if (trim($className) === '') {
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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',
|
||||||
|
|||||||
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user