mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Add static closure check
This commit is contained in:
@ -90,6 +90,11 @@ final class TestCaseMethodFactory
|
|||||||
throw ShouldNotHappen::fromMessage('Description can not be empty.');
|
throw ShouldNotHappen::fromMessage('Description can not be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($reflection = new ReflectionClosure($this->closure))->isStatic()) {
|
||||||
|
$fileAndLine = $reflection->getFileName() . ':' . $reflection->getStartLine();
|
||||||
|
throw ShouldNotHappen::fromMessage("The test `$this->description` closure must not be static in $fileAndLine.");
|
||||||
|
}
|
||||||
|
|
||||||
$closure = $this->closure;
|
$closure = $this->closure;
|
||||||
|
|
||||||
$testCase = TestSuite::getInstance()->tests->get($this->filename);
|
$testCase = TestSuite::getInstance()->tests->get($this->filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user