mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 01:07:23 +01:00
Adds assignees
This commit is contained in:
27
src/TestCaseMethodFilters/AssigneeTestCaseFilter.php
Normal file
27
src/TestCaseMethodFilters/AssigneeTestCaseFilter.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\TestCaseMethodFilters;
|
||||
|
||||
use Pest\Contracts\TestCaseMethodFilter;
|
||||
use Pest\Factories\TestCaseMethodFactory;
|
||||
|
||||
final readonly class AssigneeTestCaseFilter implements TestCaseMethodFilter
|
||||
{
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*/
|
||||
public function __construct(private string $assignee)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the test case methods.
|
||||
*/
|
||||
public function accept(TestCaseMethodFactory $factory): bool
|
||||
{
|
||||
return array_filter($factory->assignees, fn ($assignee): bool => str_starts_with($assignee, $this->assignee)) !== [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user