!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/it-man.ztu.edu.ua/src/vendor/symfony/http-foundation/Tests/File/   drwxr-xr-x
Free 116.64 GB of 200.55 GB (58.16%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     UploadedFileTest.php (7.05 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpFoundation\Tests\File;

use 
Symfony\Component\HttpFoundation\File\UploadedFile;

class 
UploadedFileTest extends \PHPUnit_Framework_TestCase
{
    protected function 
setUp()
    {
        if (!
ini_get('file_uploads')) {
            
$this->markTestSkipped('file_uploads is disabled in php.ini');
        }
    }

    public function 
testConstructWhenFileNotExists()
    {
        
$this->setExpectedException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');

        new 
UploadedFile(
            
__DIR__.'/Fixtures/not_here',
            
'original.gif',
            
null
        
);
    }

    public function 
testFileUploadsWithNoMimeType()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
null,
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
UPLOAD_ERR_OK
        
);

        
$this->assertEquals('application/octet-stream'$file->getClientMimeType());

        if (
extension_loaded('fileinfo')) {
            
$this->assertEquals('image/gif'$file->getMimeType());
        }
    }

    public function 
testFileUploadsWithUnknownMimeType()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/.unknownextension',
            
'original.gif',
            
null,
            
filesize(__DIR__.'/Fixtures/.unknownextension'),
            
UPLOAD_ERR_OK
        
);

        
$this->assertEquals('application/octet-stream'$file->getClientMimeType());
    }

    public function 
testGuessClientExtension()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals('gif'$file->guessClientExtension());
    }

    public function 
testGuessClientExtensionWithIncorrectMimeType()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/jpeg',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals('jpeg'$file->guessClientExtension());
    }

    public function 
testErrorIsOkByDefault()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals(UPLOAD_ERR_OK$file->getError());
    }

    public function 
testGetClientOriginalName()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals('original.gif'$file->getClientOriginalName());
    }

    public function 
testGetClientOriginalExtension()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals('gif'$file->getClientOriginalExtension());
    }

    
/**
     * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileException
     */
    
public function testMoveLocalFileIsNotAllowed()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
UPLOAD_ERR_OK
        
);

        
$movedFile $file->move(__DIR__.'/Fixtures/directory');
    }

    public function 
testMoveLocalFileIsAllowedInTestMode()
    {
        
$path __DIR__.'/Fixtures/test.copy.gif';
        
$targetDir __DIR__.'/Fixtures/directory';
        
$targetPath $targetDir.'/test.copy.gif';
        @
unlink($path);
        @
unlink($targetPath);
        
copy(__DIR__.'/Fixtures/test.gif'$path);

        
$file = new UploadedFile(
            
$path,
            
'original.gif',
            
'image/gif',
            
filesize($path),
            
UPLOAD_ERR_OK,
            
true
        
);

        
$movedFile $file->move(__DIR__.'/Fixtures/directory');

        
$this->assertFileExists($targetPath);
        
$this->assertFileNotExists($path);
        
$this->assertEquals(realpath($targetPath), $movedFile->getRealPath());

        @
unlink($targetPath);
    }

    public function 
testGetClientOriginalNameSanitizeFilename()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'../../original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals('original.gif'$file->getClientOriginalName());
    }

    public function 
testGetSize()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
'image/gif',
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
null
        
);

        
$this->assertEquals(filesize(__DIR__.'/Fixtures/test.gif'), $file->getSize());

        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test',
            
'original.gif',
            
'image/gif'
        
);

        
$this->assertEquals(filesize(__DIR__.'/Fixtures/test'), $file->getSize());
    }

    public function 
testGetExtension()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
null
        
);

        
$this->assertEquals('gif'$file->getExtension());
    }

    public function 
testIsValid()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
null,
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
UPLOAD_ERR_OK,
            
true
        
);

        
$this->assertTrue($file->isValid());
    }

    
/**
     * @dataProvider uploadedFileErrorProvider
     */
    
public function testIsInvalidOnUploadError($error)
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
null,
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
$error
        
);

        
$this->assertFalse($file->isValid());
    }

    public function 
uploadedFileErrorProvider()
    {
        return array(
            array(
UPLOAD_ERR_INI_SIZE),
            array(
UPLOAD_ERR_FORM_SIZE),
            array(
UPLOAD_ERR_PARTIAL),
            array(
UPLOAD_ERR_NO_TMP_DIR),
            array(
UPLOAD_ERR_EXTENSION),
        );
    }

    public function 
testIsInvalidIfNotHttpUpload()
    {
        
$file = new UploadedFile(
            
__DIR__.'/Fixtures/test.gif',
            
'original.gif',
            
null,
            
filesize(__DIR__.'/Fixtures/test.gif'),
            
UPLOAD_ERR_OK
        
);

        
$this->assertFalse($file->isValid());
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0146 ]--