pestphp/pest · error · TestCaseAlreadyInUse
The test case [%s] may not be used here. The folder [%s] is
Error message
The test case [%s] may not be used here. The folder [%s] is already bound to the test case [%s].
What it means
Error "The test case [%s] may not be used here. The folder [%s] is already bound to the test case [%s]." thrown in pestphp/pest.
Source
Thrown at src/Repositories/TestRepository.php:164
}
}
$this->make($this->testCases[$filename]);
}
private function make(TestCaseFactory $testCase): void
{
$startsWith = static fn (string $target, string $directory): bool => Str::startsWith($target, $directory.DIRECTORY_SEPARATOR);
foreach ($this->uses as $path => $uses) {
[$classOrTraits, $groups, $hooks] = $uses;
if ((! is_dir($path) && $testCase->filename === $path) || (is_dir($path) && $startsWith($testCase->filename, $path))) {
foreach ($classOrTraits as $class) {
/** @var string $class */
if (class_exists($class)) {
if ($testCase->class !== TestCase::class) {
throw new TestCaseAlreadyInUse($testCase->class, $class, $testCase->filename);
}
$testCase->class = $class;
} elseif (trait_exists($class)) {
$testCase->traits[] = $class;
}
}
foreach ($testCase->methods as $method) {
foreach ($groups as $group) {
$method->attributes[] = new Attribute(
Group::class,
[$group],
);
}
}
foreach ($testCase->methods as $method) {
$method->groups = [...$groups, ...$method->groups];View on GitHub (pinned to 1af74a215c)
When it happens
Trigger: Thrown at src/Repositories/TestRepository.php:164 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pestphp/pest@1af74a215c (2026-08-21).
Data as JSON: /api/errors/592ba4d317b05c47.
Report an issue: GitHub.