feat: always use attributes instead of annotations

This commit is contained in:
Nuno Maduro
2024-01-05 18:00:14 +00:00
parent 04d2fa5ce8
commit 53dc9ffa06
20 changed files with 152 additions and 328 deletions

View File

@ -9,9 +9,11 @@ use Pest\Contracts\TestCaseFilter;
use Pest\Contracts\TestCaseMethodFilter;
use Pest\Exceptions\TestCaseAlreadyInUse;
use Pest\Exceptions\TestCaseClassOrTraitNotFound;
use Pest\Factories\Attribute;
use Pest\Factories\TestCaseFactory;
use Pest\Factories\TestCaseMethodFactory;
use Pest\Support\Str;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
@ -181,14 +183,13 @@ final class TestRepository
foreach ($testCase->methods as $method) {
foreach ($groups as $group) {
$method->groups[] = $group;
$method->attributes[] = new Attribute(
Group::class,
[$group],
);
}
}
foreach ($testCase->methods as $method) {
$method->groups = [...$groups, ...$method->groups];
}
$testCase->factoryProxies->add($testCase->filename, 0, '__addBeforeAll', [$hooks[0] ?? null]);
$testCase->factoryProxies->add($testCase->filename, 0, '__addBeforeEach', [$hooks[1] ?? null]);
$testCase->factoryProxies->add($testCase->filename, 0, '__addAfterEach', [$hooks[2] ?? null]);