Debian Codegraph @

lib/3rdParty/composer/webklex/php-imap/tests/AttachmentTest.php

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