Skip to content

Commit b545acb

Browse files
committed
Improvement
1 parent eb44f96 commit b545acb

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

src/Symfony/Component/Security/Http/Tests/EventListener/IsCsrfTokenValidAttributeListenerTest.php

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -366,45 +366,43 @@ public function testIsCsrfTokenValidCalledCorrectlyWithCustomTokenSource(Request
366366
$listener->onKernelControllerArguments($event);
367367
}
368368

369-
public static function customSourceProvider(): array
369+
public static function customSourceProvider(): \Generator
370370
{
371-
return [
372-
'tokenSource Payload (default)' => [
373-
new Request(
374-
server: ['HTTP__TOKEN' => 'bar_header'],
375-
content: json_encode(['_token' => 'bar_payload']),
376-
query: ['_token' => 'bar_query']
377-
),
378-
'withDefaultTokenKey',
379-
'bar_payload',
380-
],
381-
'tokenSource Query' => [
382-
new Request(
383-
server: ['HTTP__TOKEN' => 'bar_header'],
384-
content: json_encode(['_token' => 'bar_payload']),
385-
query: ['_token' => 'bar_query']
386-
),
387-
'withCustomTokenSourceQuery',
388-
'bar_query',
389-
],
390-
'tokenSource Query|Payload' => [
391-
new Request(
392-
server: ['HTTP__TOKEN' => 'bar_header'],
393-
content: json_encode(['_token' => 'bar_payload']),
394-
query: ['_token' => 'bar_query']
395-
),
396-
'withCustomTokenSourceQueryPayload',
397-
'bar_payload',
398-
],
399-
'tokenSource Header and custom sourceToken' => [
400-
new Request(
401-
server: ['HTTP_MY_TOKEN_KEY' => 'bar_header'],
402-
content: json_encode(['my_token_key' => 'bar_payload']),
403-
query: ['my_token_key' => 'bar_query']
404-
),
405-
'withCustomTokenSourceHeaderAndCustomSourceToken',
406-
'bar_header',
407-
],
371+
yield 'tokenSource Payload (default)' => [
372+
new Request(
373+
server: ['HTTP__TOKEN' => 'bar_header'],
374+
content: json_encode(['_token' => 'bar_payload']),
375+
query: ['_token' => 'bar_query']
376+
),
377+
'withDefaultTokenKey',
378+
'bar_payload',
379+
];
380+
yield 'tokenSource Query' => [
381+
new Request(
382+
server: ['HTTP__TOKEN' => 'bar_header'],
383+
content: json_encode(['_token' => 'bar_payload']),
384+
query: ['_token' => 'bar_query']
385+
),
386+
'withCustomTokenSourceQuery',
387+
'bar_query',
388+
];
389+
yield 'tokenSource Query|Payload' => [
390+
new Request(
391+
server: ['HTTP__TOKEN' => 'bar_header'],
392+
content: json_encode(['_token' => 'bar_payload']),
393+
query: ['_token' => 'bar_query']
394+
),
395+
'withCustomTokenSourceQueryPayload',
396+
'bar_payload',
397+
];
398+
yield 'tokenSource Header and custom sourceToken' => [
399+
new Request(
400+
server: ['HTTP_MY_TOKEN_KEY' => 'bar_header'],
401+
content: json_encode(['my_token_key' => 'bar_payload']),
402+
query: ['my_token_key' => 'bar_query']
403+
),
404+
'withCustomTokenSourceHeaderAndCustomSourceToken',
405+
'bar_header',
408406
];
409407
}
410408
}

0 commit comments

Comments
 (0)