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

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/php55/usr/share/pear/test/Form/Symfony/Component/Form/Tests/   drwxr-xr-x
Free 294 GB of 429.69 GB (68.42%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     NativeRequestHandlerTest.php (5.78 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\Form\Tests;

use 
Symfony\Component\Form\NativeRequestHandler;

/**
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class NativeRequestHandlerTest extends AbstractRequestHandlerTest
{
    private static 
$serverBackup;

    public static function 
setUpBeforeClass()
    {
        
self::$serverBackup $_SERVER;
    }

    protected function 
setUp()
    {
        
parent::setUp();

        
$_GET = array();
        
$_POST = array();
        
$_FILES = array();
        
$_SERVER = array(
            
// PHPUnit needs this entry
            
'SCRIPT_NAME' => self::$serverBackup['SCRIPT_NAME'],
        );
    }

    protected function 
tearDown()
    {
        
parent::tearDown();

        
$_GET = array();
        
$_POST = array();
        
$_FILES = array();
        
$_SERVER self::$serverBackup;
    }

    
/**
     * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
     */
    
public function testRequestShouldBeNull()
    {
        
$this->requestHandler->handleRequest($this->getMockForm('name''GET'), 'request');
    }

    public function 
testMethodOverrideHeaderTakesPrecedenceIfPost()
    {
        
$form $this->getMockForm('param1''PUT');

        
$this->setRequestData('POST', array(
            
'param1' => 'DATA',
        ));

        
$_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';

        
$form->expects($this->once())
            ->
method('submit')
            ->
with('DATA');

        
$this->requestHandler->handleRequest($form$this->request);
    }

    public function 
testConvertEmptyUploadedFilesToNull()
    {
        
$form $this->getMockForm('param1''POST'false);

        
$this->setRequestData('POST', array(), array('param1' => array(
            
'name' => '',
            
'type' => '',
            
'tmp_name' => '',
            
'error' => UPLOAD_ERR_NO_FILE,
            
'size' => 0
        
)));

        
$form->expects($this->once())
            ->
method('submit')
            ->
with($this->identicalTo(null));

        
$this->requestHandler->handleRequest($form$this->request);
    }

    public function 
testFixBuggyFilesArray()
    {
        
$form $this->getMockForm('param1''POST'false);

        
$this->setRequestData('POST', array(), array('param1' => array(
            
'name' => array(
                
'field' => 'upload.txt',
            ),
            
'type' => array(
                
'field' => 'text/plain',
            ),
            
'tmp_name' => array(
                
'field' => 'owfdskjasdfsa',
            ),
            
'error' => array(
                
'field' => UPLOAD_ERR_OK,
            ),
            
'size' => array(
                
'field' => 100,
            ),
        )));

        
$form->expects($this->once())
            ->
method('submit')
            ->
with(array(
                
'field' => array(
                    
'name' => 'upload.txt',
                    
'type' => 'text/plain',
                    
'tmp_name' => 'owfdskjasdfsa',
                    
'error' => UPLOAD_ERR_OK,
                    
'size' => 100,
                ),
            ));

        
$this->requestHandler->handleRequest($form$this->request);
    }

    public function 
testFixBuggyNestedFilesArray()
    {
        
$form $this->getMockForm('param1''POST');

        
$this->setRequestData('POST', array(), array('param1' => array(
            
'name' => array(
                
'field' => array('subfield' => 'upload.txt'),
            ),
            
'type' => array(
                
'field' => array('subfield' => 'text/plain'),
            ),
            
'tmp_name' => array(
                
'field' => array('subfield' => 'owfdskjasdfsa'),
            ),
            
'error' => array(
                
'field' => array('subfield' => UPLOAD_ERR_OK),
            ),
            
'size' => array(
                
'field' => array('subfield' => 100),
            ),
        )));

        
$form->expects($this->once())
            ->
method('submit')
            ->
with(array(
                
'field' => array(
                    
'subfield' => array(
                        
'name' => 'upload.txt',
                        
'type' => 'text/plain',
                        
'tmp_name' => 'owfdskjasdfsa',
                        
'error' => UPLOAD_ERR_OK,
                        
'size' => 100,
                    ),
                ),
            ));

        
$this->requestHandler->handleRequest($form$this->request);
    }

    public function 
testMethodOverrideHeaderIgnoredIfNotPost()
    {
        
$form $this->getMockForm('param1''POST');

        
$this->setRequestData('GET', array(
                
'param1' => 'DATA',
            ));

        
$_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';

        
$form->expects($this->never())
            ->
method('submit');

        
$this->requestHandler->handleRequest($form$this->request);
    }

    protected function 
setRequestData($method$data$files = array())
    {
        if (
'GET' === $method) {
            
$_GET $data;
            
$_FILES = array();
        } else {
            
$_POST $data;
            
$_FILES $files;
        }

        
$_SERVER = array(
            
'REQUEST_METHOD' => $method,
            
// PHPUnit needs this entry
            
'SCRIPT_NAME' => self::$serverBackup['SCRIPT_NAME'],
        );
    }

    protected function 
getRequestHandler()
    {
        return new 
NativeRequestHandler();
    }

    protected function 
getMockFile()
    {
        return array(
            
'name' => 'upload.txt',
            
'type' => 'text/plain',
            
'tmp_name' => 'owfdskjasdfsa',
            
'error' => UPLOAD_ERR_OK,
            
'size' => 100,
        );
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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