1<?php 2 3/** 4 * This file is part of the Phalcon Framework. 5 * 6 * (c) Phalcon Team <team@phalcon.io> 7 * 8 * For the full copyright and license information, please view the LICENSE.txt 9 * file that was distributed with this source code. 10 */ 11 12declare(strict_types=1); 13 14namespace Phalcon\Test\Unit\Http\Request\File; 15 16use Phalcon\Http\Request\File; 17use UnitTester; 18 19use function dataDir; 20use function function_exists; 21 22class GetRealTypeCest 23{ 24 /** 25 * Tests Phalcon\Http\Request\File :: getRealType() 26 * 27 * @issue https://github.com/phalcon/cphalcon/issues/1442 28 * @author Phalcon Team <team@phalcon.io> 29 * @author Dreamszhu <dreamsxin@qq.com> 30 * @since 2013-10-26 31 */ 32 public function httpRequestFileGetRealType(UnitTester $I) 33 { 34 $I->wantToTest('Http\Request\File - getRealType()'); 35 36 if (!function_exists('finfo_open')) { 37 $I->skipTest('fileinfo extension missing'); 38 } 39 40 $file = new File( 41 [ 42 'name' => 'test', 43 'type' => 'text/plain', 44 'tmp_name' => dataDir('/assets/images/phalconphp.jpg'), 45 'size' => 1, 46 'error' => 0, 47 ] 48 ); 49 50 $I->assertEquals('image/jpeg', $file->getRealType()); 51 } 52} 53