mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
Fixes using test cases on uses with tests
This commit is contained in:
@ -240,6 +240,24 @@ final class TestCaseFactory
|
||||
$this->methods[$method->description] = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a test case has a method.
|
||||
*/
|
||||
public function hasMethod(string $methodName): bool
|
||||
{
|
||||
foreach ($this->methods as $method) {
|
||||
if ($method->description === null) {
|
||||
throw ShouldNotHappen::fromMessage('The test description may not be empty.');
|
||||
}
|
||||
|
||||
if (Str::evaluable($method->description) === $methodName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Method by the given name.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user