mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
30 lines
643 B
PHP
30 lines
643 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pest\Factories\Annotations;
|
|
|
|
use Pest\Contracts\AddsAnnotations;
|
|
use Pest\Factories\TestCaseMethodFactory;
|
|
use Pest\Support\Str;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class Depends implements AddsAnnotations
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function __invoke(TestCaseMethodFactory $method, array $annotations): array
|
|
{
|
|
foreach ($method->depends as $depend) {
|
|
$depend = Str::evaluable($method->describing !== null ? Str::describe($method->describing, $depend) : $depend);
|
|
|
|
$annotations[] = "@depends $depend";
|
|
}
|
|
|
|
return $annotations;
|
|
}
|
|
}
|