@@ 20-37 (lines=18) @@ | ||
17 | /** |
|
18 | * |
|
19 | */ |
|
20 | public function testUploadFromRequestValid() |
|
21 | { |
|
22 | $letter = new PdfLetter(); |
|
23 | $letter->id = 10; |
|
24 | ||
25 | $uploadedFile = new UploadedFile( |
|
26 | TEST_FIXTURE_PATH . '/files/file.pdf', |
|
27 | 'test original name.pdf', |
|
28 | 'application/pdf', |
|
29 | null, |
|
30 | null, |
|
31 | true |
|
32 | ); |
|
33 | ||
34 | $response = $letter->uploadFromRequest($uploadedFile); |
|
35 | parent::assertInstanceOf(Media::class, $response); |
|
36 | self::assertFileExists(TEST_FIXTURE_PATH . '/files/pdf_letters/10/file.pdf'); |
|
37 | } |
|
38 | ||
39 | public function testUploadFromRequestWithInvalidFileType() |
|
40 | { |
|
@@ 39-55 (lines=17) @@ | ||
36 | self::assertFileExists(TEST_FIXTURE_PATH . '/files/pdf_letters/10/file.pdf'); |
|
37 | } |
|
38 | ||
39 | public function testUploadFromRequestWithInvalidFileType() |
|
40 | { |
|
41 | $letter = new PdfLetter(); |
|
42 | $letter->id = 10; |
|
43 | ||
44 | $uploadedFile = new UploadedFile( |
|
45 | TEST_FIXTURE_PATH . '/files/file.pdf', |
|
46 | 'test original name.doc', |
|
47 | null, |
|
48 | null, |
|
49 | null, |
|
50 | true |
|
51 | ); |
|
52 | ||
53 | $response = $letter->uploadFromRequest($uploadedFile); |
|
54 | parent::assertSame('INVALID_MIME_TYPE_ERROR', $response); |
|
55 | } |
|
56 | ||
57 | public function testGenerateFile() |
|
58 | { |