-
-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathAttachmentTest.php
37 lines (31 loc) · 924 Bytes
/
AttachmentTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace Tests;
use Tests\fixtures\FixtureTestCase;
use Webklex\PHPIMAP\Attachment;
class AttachmentTest extends FixtureTestCase
{
protected Attachment $attachment;
public function setUp(): void
{
$message = $this->getFixture("attachment_encoded_filename.eml");
$this->attachment = $message->getAttachments()->first();
}
/**
* @dataProvider decodeNameDataProvider
*/
public function testDecodeName(string $input, string $output): void
{
$name = $this->attachment->decodeName($input);
$this->assertEquals($output, $name);
}
public function decodeNameDataProvider(): array
{
return [
['../../../../../../../../../../../var/www/shell.php', 'varwwwshell.php'],
['test..xml', 'test.xml'],
[chr(0), ''],
['C:\\file.txt', 'Cfile.txt'],
];
}
}