|
9 | 9 | use AsyncAws\Core\Stream\IterableStream; |
10 | 10 | use AsyncAws\Core\Stream\RequestStream; |
11 | 11 | use AsyncAws\Core\Stream\StringStream; |
| 12 | +use PHPUnit\Framework\Attributes\DataProvider; |
12 | 13 | use PHPUnit\Framework\TestCase; |
13 | 14 |
|
14 | 15 | class FixedSizeStreamTest extends TestCase |
15 | 16 | { |
16 | | - /** |
17 | | - * @dataProvider provideLengths |
18 | | - */ |
| 17 | + #[DataProvider('provideLengths')] |
19 | 18 | public function testLength(RequestStream $content, ?int $expected): void |
20 | 19 | { |
21 | 20 | $stream = FixedSizeStream::create($content); |
22 | 21 |
|
23 | 22 | self::assertSame($expected, $stream->length()); |
24 | 23 | } |
25 | 24 |
|
26 | | - /** |
27 | | - * @dataProvider provideStrings |
28 | | - */ |
| 25 | + #[DataProvider('provideStrings')] |
29 | 26 | public function testStringify(RequestStream $content, string $expected): void |
30 | 27 | { |
31 | 28 | $stream = FixedSizeStream::create($content); |
32 | 29 |
|
33 | 30 | self::assertSame($expected, $stream->stringify()); |
34 | 31 | } |
35 | 32 |
|
36 | | - /** |
37 | | - * @dataProvider provideChunks |
38 | | - */ |
| 33 | + #[DataProvider('provideChunks')] |
39 | 34 | public function testChunk(RequestStream $content, int $size, array $expected): void |
40 | 35 | { |
41 | 36 | $stream = FixedSizeStream::create($content, $size); |
42 | 37 |
|
43 | 38 | self::assertSame($expected, iterator_to_array($stream)); |
44 | 39 | } |
45 | 40 |
|
46 | | - /** |
47 | | - * @dataProvider provideChunks |
48 | | - */ |
| 41 | + #[DataProvider('provideChunks')] |
49 | 42 | public function testDecoratingFixedSize(RequestStream $content, int $size, array $expected): void |
50 | 43 | { |
51 | 44 | $stream = FixedSizeStream::create(FixedSizeStream::create($content, 5), $size); |
52 | 45 |
|
53 | 46 | self::assertSame($expected, iterator_to_array($stream)); |
54 | 47 | } |
55 | 48 |
|
56 | | - public function provideLengths(): iterable |
| 49 | + public static function provideLengths(): iterable |
57 | 50 | { |
58 | 51 | yield [StringStream::create('Hello world'), 11]; |
59 | 52 | yield [CallableStream::create(function () {}), null]; |
60 | 53 | } |
61 | 54 |
|
62 | | - public function provideStrings(): iterable |
| 55 | + public static function provideStrings(): iterable |
63 | 56 | { |
64 | 57 | yield [StringStream::create('Hello world'), 'Hello world']; |
65 | 58 | yield [IterableStream::create((function () { yield 'Hello world'; })()), 'Hello world']; |
66 | 59 | } |
67 | 60 |
|
68 | | - public function provideChunks(): iterable |
| 61 | + public static function provideChunks(): iterable |
69 | 62 | { |
70 | 63 | yield [StringStream::create('Hello world'), 3, ['Hel', 'lo ', 'wor', 'ld']]; |
71 | 64 | yield [IterableStream::create((function () { |
|
0 commit comments