Skip to content

Commit 96e1c04

Browse files
committed
array => Generator
1 parent 90f131f commit 96e1c04

File tree

5 files changed

+115
-110
lines changed

5 files changed

+115
-110
lines changed

tests/Signature/HmacMd5SignatureTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ public function testGetMethod()
1515
$this->assertSame('HMAC-MD5', (new HmacMd5Signature(new ConsumerSecret('secret')))->getMethod());
1616
}
1717

18-
public function provideSign(): array
18+
public function provideSign(): \Generator
1919
{
20-
return [
21-
[
22-
new Uri('https://example.com/'),
23-
'QtfAAcCdkSRT7ZcsOf0ZMg==',
24-
'tgO8fZPz5fYTvT2fooRbVw==',
25-
],
26-
[
27-
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28-
'+ABQ6tWjft6x4qEWj2242A==',
29-
'/z1LDvLoyrM2/2UNr1vMfg==',
30-
],
31-
[
32-
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
33-
'a1zvAGr9rNs+zbSnA4eAqQ==',
34-
'yVkadb1I3VWMaCpqp5ucYw==',
35-
],
36-
[
37-
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
38-
'QtfAAcCdkSRT7ZcsOf0ZMg==',
39-
'tgO8fZPz5fYTvT2fooRbVw==',
40-
],
20+
yield [
21+
new Uri('https://example.com/'),
22+
'QtfAAcCdkSRT7ZcsOf0ZMg==',
23+
'tgO8fZPz5fYTvT2fooRbVw==',
24+
];
25+
26+
yield [
27+
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28+
'+ABQ6tWjft6x4qEWj2242A==',
29+
'/z1LDvLoyrM2/2UNr1vMfg==',
30+
];
31+
32+
yield [
33+
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
34+
'a1zvAGr9rNs+zbSnA4eAqQ==',
35+
'yVkadb1I3VWMaCpqp5ucYw==',
36+
];
37+
38+
yield [
39+
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
40+
'QtfAAcCdkSRT7ZcsOf0ZMg==',
41+
'tgO8fZPz5fYTvT2fooRbVw==',
4142
];
4243
}
4344

tests/Signature/HmacSha1SignatureTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ public function testGetMethod()
1515
$this->assertSame('HMAC-SHA1', (new HmacSha1Signature(new ConsumerSecret('secret')))->getMethod());
1616
}
1717

18-
public function provideSign(): array
18+
public function provideSign(): \Generator
1919
{
20-
return [
21-
[
22-
new Uri('https://example.com/'),
23-
'T7pWk5I7re3JTz5FS3LK8rVbQ0U=',
24-
'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=',
25-
],
26-
[
27-
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28-
'XyTxyDmU2s3iBMBpSX4DbZ47Ltg=',
29-
'H6aCWT5WcUlqw4/qXVm4tMjE7P0=',
30-
],
31-
[
32-
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
33-
'OXZBqYIhLdj7CT6bYudGqc8OzlU=',
34-
'3oA2qaA8dpQFdB8n0tyjrXLNvsg=',
35-
],
36-
[
37-
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
38-
'T7pWk5I7re3JTz5FS3LK8rVbQ0U=',
39-
'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=',
40-
],
20+
yield [
21+
new Uri('https://example.com/'),
22+
'T7pWk5I7re3JTz5FS3LK8rVbQ0U=',
23+
'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=',
24+
];
25+
26+
yield [
27+
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28+
'XyTxyDmU2s3iBMBpSX4DbZ47Ltg=',
29+
'H6aCWT5WcUlqw4/qXVm4tMjE7P0=',
30+
];
31+
32+
yield [
33+
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
34+
'OXZBqYIhLdj7CT6bYudGqc8OzlU=',
35+
'3oA2qaA8dpQFdB8n0tyjrXLNvsg=',
36+
];
37+
38+
yield [
39+
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
40+
'T7pWk5I7re3JTz5FS3LK8rVbQ0U=',
41+
'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=',
4142
];
4243
}
4344

tests/Signature/HmacSha256SignatureTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ public function testGetMethod()
1515
$this->assertSame('HMAC-SHA256', (new HmacSha256Signature(new ConsumerSecret('secret')))->getMethod());
1616
}
1717

18-
public function provideSign(): array
18+
public function provideSign(): \Generator
1919
{
20-
return [
21-
[
22-
new Uri('https://example.com/'),
23-
'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=',
24-
'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=',
25-
],
26-
[
27-
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28-
'u5nNam6Cn+fCko38qAgxWUYmRrPPTF5OFOC9wZ4LHRg=',
29-
'8IQ1uD3ZR+b8U0Fd++pGGzqNmKiF94z3psbsa+M0SxQ=',
30-
],
31-
[
32-
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
33-
'SlDm7qfJO/mxl1Ewnewj46jjbuCEKYGNTeew2uMDwPM=',
34-
'5vVeCSAcL52LVGWWQ1pUFUe7cpVwkhreMQMck3PEw+E=',
35-
],
36-
[
37-
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
38-
'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=',
39-
'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=',
40-
],
20+
yield [
21+
new Uri('https://example.com/'),
22+
'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=',
23+
'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=',
24+
];
25+
26+
yield [
27+
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28+
'u5nNam6Cn+fCko38qAgxWUYmRrPPTF5OFOC9wZ4LHRg=',
29+
'8IQ1uD3ZR+b8U0Fd++pGGzqNmKiF94z3psbsa+M0SxQ=',
30+
];
31+
32+
yield [
33+
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
34+
'SlDm7qfJO/mxl1Ewnewj46jjbuCEKYGNTeew2uMDwPM=',
35+
'5vVeCSAcL52LVGWWQ1pUFUe7cpVwkhreMQMck3PEw+E=',
36+
];
37+
38+
yield [
39+
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
40+
'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=',
41+
'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=',
4142
];
4243
}
4344

tests/Signature/HmacSha384SignatureTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ public function testGetMethod()
1515
$this->assertSame('HMAC-SHA384', (new HmacSha384Signature(new ConsumerSecret('secret')))->getMethod());
1616
}
1717

18-
public function provideSign(): array
18+
public function provideSign(): \Generator
1919
{
20-
return [
21-
[
22-
new Uri('https://example.com/'),
23-
'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7',
24-
'0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN',
25-
],
26-
[
27-
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28-
'Bm+fK6fVlejPvOcrQJcv+ZwsgQdh9W3Ok/ljmY39vy0MxymzH+I+Hntcxi90/Qfq',
29-
'mjT2JRgSTEdrMJi6/eJ6mZBh7C2bWT9HVqS1Gq6JpXJHNPze7gy7XdA4sgy3ORwE',
30-
],
31-
[
32-
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
33-
'+88Vdw/72CKTOJpUM42FZLkQnBakun9M9lKVzk8a9T9TpmK9Sn6MP4hp7id/VJRj',
34-
'FKV3k1/PDOZTwMO6fE74NisTlixs1qlLt5IedDWVoIyk9tyNNAUIjwOt7w1GtnHH',
35-
],
36-
[
37-
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
38-
'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7',
39-
'0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN',
40-
],
20+
yield [
21+
new Uri('https://example.com/'),
22+
'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7',
23+
'0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN',
24+
];
25+
26+
yield [
27+
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28+
'Bm+fK6fVlejPvOcrQJcv+ZwsgQdh9W3Ok/ljmY39vy0MxymzH+I+Hntcxi90/Qfq',
29+
'mjT2JRgSTEdrMJi6/eJ6mZBh7C2bWT9HVqS1Gq6JpXJHNPze7gy7XdA4sgy3ORwE',
30+
];
31+
32+
yield [
33+
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
34+
'+88Vdw/72CKTOJpUM42FZLkQnBakun9M9lKVzk8a9T9TpmK9Sn6MP4hp7id/VJRj',
35+
'FKV3k1/PDOZTwMO6fE74NisTlixs1qlLt5IedDWVoIyk9tyNNAUIjwOt7w1GtnHH',
36+
];
37+
38+
yield [
39+
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
40+
'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7',
41+
'0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN',
4142
];
4243
}
4344

tests/Signature/HmacSha512SignatureTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ public function testGetMethod()
1515
$this->assertSame('HMAC-SHA512', (new HmacSha512Signature(new ConsumerSecret('secret')))->getMethod());
1616
}
1717

18-
public function provideSign(): array
18+
public function provideSign(): \Generator
1919
{
20-
return [
21-
[
22-
new Uri('https://example.com/'),
23-
'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==',
24-
'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==',
25-
],
26-
[
27-
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28-
'/I2kMebX4xOddQTfJevI6wzFvltybVUTsHlL7h5LcsgySv2Me1+6XC35e79sKFWpw5WTYaOCM7D2MNInA5NKUw==',
29-
'kG+XGV4utRgXWt3tbJ5361sWHn86plmm1FcLYfjjRL0l1Ogv0D5lMOMWBrCt1pRGhO05he+DPUqZffyBh4M5GA==',
30-
],
31-
[
32-
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
33-
'buNZpqvSzvJI1G1NLVGuiJnm/ZmZ59yfjGhUCXp8E8J98oEQHTMNua3Kawv41ejoj+KPgqw9JMZ/8HKeO7zvgg==',
34-
'xAllQX+xlZ6bzmthcEDZ9pyC5nyARMPaTuCe34YC9XeFIvAN+QRM1MattDvssurZN8UMPYHeyvbge1rPxygL8A==',
35-
],
36-
[
37-
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
38-
'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==',
39-
'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==',
40-
],
20+
yield [
21+
new Uri('https://example.com/'),
22+
'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==',
23+
'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==',
24+
];
25+
26+
yield [
27+
new Uri('https://example.com/thea.pot',[], 'THEAPOT'),
28+
'/I2kMebX4xOddQTfJevI6wzFvltybVUTsHlL7h5LcsgySv2Me1+6XC35e79sKFWpw5WTYaOCM7D2MNInA5NKUw==',
29+
'kG+XGV4utRgXWt3tbJ5361sWHn86plmm1FcLYfjjRL0l1Ogv0D5lMOMWBrCt1pRGhO05he+DPUqZffyBh4M5GA==',
30+
];
31+
32+
yield [
33+
new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]),
34+
'buNZpqvSzvJI1G1NLVGuiJnm/ZmZ59yfjGhUCXp8E8J98oEQHTMNua3Kawv41ejoj+KPgqw9JMZ/8HKeO7zvgg==',
35+
'xAllQX+xlZ6bzmthcEDZ9pyC5nyARMPaTuCe34YC9XeFIvAN+QRM1MattDvssurZN8UMPYHeyvbge1rPxygL8A==',
36+
];
37+
38+
yield [
39+
new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'),
40+
'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==',
41+
'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==',
4142
];
4243
}
4344

0 commit comments

Comments
 (0)