Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MimeTest.php
Go to the documentation of this file.
1 <?php
7 
8 class MimeTest extends \PHPUnit\Framework\TestCase
9 {
13  private $object;
14 
15  protected function setUp()
16  {
17  $this->object = new \Magento\Framework\File\Mime();
18  }
19 
25  {
26  $file = 'nonexistent.file';
27  $this->object->getMimeType($file);
28  }
29 
36  public function testGetMimeType($file, $expectedType)
37  {
38  $actualType = $this->object->getMimeType($file);
39  $this->assertSame($expectedType, $actualType);
40  }
41 
45  public function getMimeTypeDataProvider()
46  {
47  return [
48  'javascript' => [__DIR__ . '/_files/javascript.js', 'application/javascript'],
49  'weird extension' => [__DIR__ . '/_files/file.weird', 'application/octet-stream'],
50  'weird uppercase extension' => [__DIR__ . '/_files/UPPERCASE.WEIRD', 'application/octet-stream'],
51  ];
52  }
53 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
testGetMimeType($file, $expectedType)
Definition: MimeTest.php:36