Uses Collision ^7.0

This commit is contained in:
Nuno Maduro
2022-09-15 01:07:15 +01:00
parent eab944023c
commit 3ff95faaaa
47 changed files with 646 additions and 308 deletions

View File

@ -9,13 +9,21 @@ use Pest\Support\ChainableClosure;
use Pest\Support\ExceptionTrace;
use Pest\Support\Reflection;
use Pest\TestSuite;
use PHPUnit\Framework\TestCase;
use Throwable;
/**
* @internal
*
* @mixin TestCase
*/
trait Testable
{
/**
* Test method description.
*/
private static string $__description;
/**
* The Test Case "test" closure.
*/
@ -118,14 +126,6 @@ trait Testable
: $hook;
}
/**
* Gets the Test Case filename.
*/
public static function __getFilename(): string
{
return self::$__filename;
}
/**
* This method is called before the first test of this Test Case is run.
*/
@ -211,6 +211,13 @@ trait Testable
*/
private function __resolveTestArguments(array $arguments): array
{
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
if ($this->dataName()) {
self::$__description = $method->description . ' with ' . $this->dataName();
} else {
self::$__description = $method->description;
}
if (count($arguments) !== 1) {
return $arguments;
}
@ -246,8 +253,16 @@ trait Testable
/**
* Gets the Test Case name that should be used by printers.
*/
public function getPrintableTestCaseName(): string
public static function getPrintableTestCaseName(): string
{
return ltrim(self::class, 'P\\');
}
/**
* Gets the Test Case name that should be used by printers.
*/
public static function getPrintableTestCaseMethodName(): string
{
return self::$__description;
}
}