feat: deprecates only feature

This commit is contained in:
Nuno Maduro
2023-02-14 08:40:02 +00:00
parent ea6af719e0
commit a61db76c24
8 changed files with 8 additions and 88 deletions

View File

@ -13,7 +13,6 @@ use Pest\Exceptions\ShouldNotHappen;
use Pest\Exceptions\TestAlreadyExist;
use Pest\Exceptions\TestDescriptionMissing;
use Pest\Factories\Concerns\HigherOrderable;
use Pest\Plugins\Environment;
use Pest\Support\Reflection;
use Pest\Support\Str;
use Pest\TestSuite;
@ -83,36 +82,17 @@ final class TestCaseFactory
public function make(): void
{
$methodsUsingOnly = $this->methodsUsingOnly();
$methods = array_values(array_filter(
$this->methods,
fn ($method): bool => $methodsUsingOnly === [] || in_array($method, $methodsUsingOnly, true)
));
$methods = $this->methods;
if ($methods !== []) {
$this->evaluate($this->filename, $methods);
}
}
/**
* Returns all the "only" methods.
*
* @return array<int, TestCaseMethodFactory>
*/
public function methodsUsingOnly(): array
{
if (Environment::name() === Environment::CI) {
return [];
}
return array_values(array_filter($this->methods, static fn ($method): bool => $method->only));
}
/**
* Creates a Test Case class using a runtime evaluate.
*
* @param array<int, TestCaseMethodFactory> $methods
* @param array<string, TestCaseMethodFactory> $methods
*/
public function evaluate(string $filename, array $methods): void
{