|
11 | 11 | use APITester\Preparator\Exception\PreparatorLoadingException;
|
12 | 12 | use APITester\Preparator\TestCasesPreparator;
|
13 | 13 | use APITester\Requester\Requester;
|
14 |
| -use APITester\Util\Filterable; |
15 | 14 | use APITester\Util\Traits\TimeBoundTrait;
|
16 | 15 | use Illuminate\Support\Collection;
|
17 | 16 | use PHPUnit\Framework\TestResult;
|
18 | 17 | use PHPUnit\Framework\TestSuite;
|
19 | 18 | use Psr\Log\LoggerInterface;
|
20 | 19 | use Psr\Log\NullLogger;
|
21 |
| -use Symfony\Component\Yaml\Tag\TaggedValue; |
22 | 20 |
|
23 | 21 | /**
|
24 | 22 | * @internal
|
@@ -87,43 +85,6 @@ public function setLogger(LoggerInterface $logger): void
|
87 | 85 | $this->logger = $logger;
|
88 | 86 | }
|
89 | 87 |
|
90 |
| - /** |
91 |
| - * @param array<array<string, string>> $includeFilters |
92 |
| - * @param array<array<string, string>> $excludeFilters |
93 |
| - */ |
94 |
| - public function includes(Filterable $object, array $includeFilters = [], array $excludeFilters = []): bool |
95 |
| - { |
96 |
| - $include = true; |
97 |
| - foreach ($includeFilters as $item) { |
98 |
| - $include = true; |
99 |
| - foreach ($item as $key => $value) { |
100 |
| - [$operator, $value] = $this->handleTags($value); |
101 |
| - if (!$object->has($key, $value, $operator)) { |
102 |
| - $include = false; |
103 |
| - continue 2; |
104 |
| - } |
105 |
| - } |
106 |
| - break; |
107 |
| - } |
108 |
| - |
109 |
| - if (!$include) { |
110 |
| - return false; |
111 |
| - } |
112 |
| - |
113 |
| - foreach ($excludeFilters as $item) { |
114 |
| - foreach ($item as $key => $value) { |
115 |
| - [$operator, $value] = $this->handleTags($value); |
116 |
| - if (!$object->has($key, $value, $operator)) { |
117 |
| - continue 2; |
118 |
| - } |
119 |
| - } |
120 |
| - $include = false; |
121 |
| - break; |
122 |
| - } |
123 |
| - |
124 |
| - return $include; |
125 |
| - } |
126 |
| - |
127 | 88 | /**
|
128 | 89 | * @param array<array<string, string>> $filter
|
129 | 90 | *
|
@@ -233,13 +194,7 @@ private function prepareTestCases(): void
|
233 | 194 |
|
234 | 195 | private function filterOperation(Operations $operations): Operations
|
235 | 196 | {
|
236 |
| - return $operations->filter( |
237 |
| - fn (Operation $operation) => $this->includes( |
238 |
| - $operation, |
239 |
| - $this->filters->getInclude(), |
240 |
| - $this->filters->getExclude(), |
241 |
| - ) |
242 |
| - ); |
| 197 | + return $operations->filter(fn (Operation $operation) => $this->filters->includes($operation)); |
243 | 198 | }
|
244 | 199 |
|
245 | 200 | /**
|
@@ -301,21 +256,4 @@ private function indexInPart(?string $part, int $index, int $total): bool
|
301 | 256 |
|
302 | 257 | return false;
|
303 | 258 | }
|
304 |
| - |
305 |
| - /** |
306 |
| - * @return array{0: string, 1: string|int} |
307 |
| - */ |
308 |
| - private function handleTags(string|int|\Symfony\Component\Yaml\Tag\TaggedValue $value): array |
309 |
| - { |
310 |
| - $operator = '='; |
311 |
| - |
312 |
| - if ($value instanceof TaggedValue) { |
313 |
| - if ($value->getTag() === 'NOT') { |
314 |
| - $operator = '!='; |
315 |
| - } |
316 |
| - $value = (string) $value->getValue(); |
317 |
| - } |
318 |
| - |
319 |
| - return [$operator, $value]; |
320 |
| - } |
321 | 259 | }
|
0 commit comments