Skip to content

Commit 60d7feb

Browse files
committed
Specify filename
1 parent 416364d commit 60d7feb

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

tests/FunctionTest.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,10 @@ public function testSupportResources()
3535

3636
public function testResourcesWithStrangeNames()
3737
{
38-
$basePath = __DIR__.'/Resources/NonUtf8';
39-
$files = scandir($basePath);
38+
$resource = fopen(__DIR__.'/Resources/httplug.png', 'r');
4039

4140
$builder = new MultipartStreamBuilder();
42-
foreach ($files as $file) {
43-
if (substr($file, 0, 1) === '.') {
44-
continue;
45-
}
46-
47-
$builder->addResource('image', fopen($basePath.'/'.$file, 'r'));
48-
}
49-
41+
$builder->addResource('image', $resource, ['filename'=>'foo/bar/хлопот.png']);
5042

5143
$multipartStream = (string) $builder->build();
5244
$this->assertTrue(false !== strpos($multipartStream, 'Content-Disposition: form-data; name="image"; filename="хлопот.png"'));
-13.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)