mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
fix: --filter option
This commit is contained in:
@ -156,7 +156,7 @@ final class NameFilterIterator extends RecursiveFilterIterator
|
|||||||
if ($test instanceof HasPrintableTestCaseName) {
|
if ($test instanceof HasPrintableTestCaseName) {
|
||||||
return [
|
return [
|
||||||
$test::getPrintableTestCaseName(),
|
$test::getPrintableTestCaseName(),
|
||||||
$test::getPrintableTestCaseMethodName(),
|
$test->getPrintableTestCaseMethodName(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,12 @@ trait Testable
|
|||||||
/**
|
/**
|
||||||
* Test method description.
|
* Test method description.
|
||||||
*/
|
*/
|
||||||
private static string $__description;
|
private string $__description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test "latest" method description.
|
||||||
|
*/
|
||||||
|
private static string $__latestDescription;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Test Case "test" closure.
|
* The Test Case "test" closure.
|
||||||
@ -69,7 +74,7 @@ trait Testable
|
|||||||
|
|
||||||
if ($test->hasMethod($name)) {
|
if ($test->hasMethod($name)) {
|
||||||
$method = $test->getMethod($name);
|
$method = $test->getMethod($name);
|
||||||
self::$__description = $method->description;
|
$this->__description = self::$__latestDescription = $method->description;
|
||||||
$this->__test = $method->getClosure($this);
|
$this->__test = $method->getClosure($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +174,7 @@ trait Testable
|
|||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::$__description = $this->name();
|
$this->__description = self::$__latestDescription = $this->name();
|
||||||
|
|
||||||
TestSuite::getInstance()->test = $this;
|
TestSuite::getInstance()->test = $this;
|
||||||
|
|
||||||
@ -221,7 +226,7 @@ trait Testable
|
|||||||
{
|
{
|
||||||
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
|
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
|
||||||
|
|
||||||
self::$__description = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description;
|
$this->__description = self::$__latestDescription = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description;
|
||||||
|
|
||||||
if (count($arguments) !== 1) {
|
if (count($arguments) !== 1) {
|
||||||
return $arguments;
|
return $arguments;
|
||||||
@ -258,7 +263,7 @@ trait Testable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Test Case name that should be used by printers.
|
* The printable test case name.
|
||||||
*/
|
*/
|
||||||
public static function getPrintableTestCaseName(): string
|
public static function getPrintableTestCaseName(): string
|
||||||
{
|
{
|
||||||
@ -266,10 +271,18 @@ trait Testable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Test Case name that should be used by printers.
|
* The printable test case method name.
|
||||||
*/
|
*/
|
||||||
public static function getPrintableTestCaseMethodName(): string
|
public function getPrintableTestCaseMethodName(): string
|
||||||
{
|
{
|
||||||
return self::$__description;
|
return $this->__description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The latest printable test case method name.
|
||||||
|
*/
|
||||||
|
public static function getLatestPrintableTestCaseMethodName(): string
|
||||||
|
{
|
||||||
|
return self::$__latestDescription;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user