!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/php54/usr/share/pear/test/HttpFoundation/Symfony/Component/HttpFoundation/Tests/   drwxr-xr-x
Free 293.91 GB of 429.69 GB (68.4%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     JsonResponseTest.php (6.26 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;

use 
Symfony\Component\HttpFoundation\JsonResponse;

class 
JsonResponseTest extends \PHPUnit_Framework_TestCase
{
    public function 
testConstructorEmptyCreatesJsonObject()
    {
        
$response = new JsonResponse();
        
$this->assertSame('{}'$response->getContent());
    }

    public function 
testConstructorWithArrayCreatesJsonArray()
    {
        
$response = new JsonResponse(array(0123));
        
$this->assertSame('[0,1,2,3]'$response->getContent());
    }

    public function 
testConstructorWithAssocArrayCreatesJsonObject()
    {
        
$response = new JsonResponse(array('foo' => 'bar'));
        
$this->assertSame('{"foo":"bar"}'$response->getContent());
    }

    public function 
testConstructorWithSimpleTypes()
    {
        
$response = new JsonResponse('foo');
        
$this->assertSame('"foo"'$response->getContent());

        
$response = new JsonResponse(0);
        
$this->assertSame('0'$response->getContent());

        
$response = new JsonResponse(0.1);
        
$this->assertSame('0.1'$response->getContent());

        
$response = new JsonResponse(true);
        
$this->assertSame('true'$response->getContent());
    }

    public function 
testConstructorWithCustomStatus()
    {
        
$response = new JsonResponse(array(), 202);
        
$this->assertSame(202$response->getStatusCode());
    }

    public function 
testConstructorAddsContentTypeHeader()
    {
        
$response = new JsonResponse();
        
$this->assertSame('application/json'$response->headers->get('Content-Type'));
    }

    public function 
testConstructorWithCustomHeaders()
    {
        
$response = new JsonResponse(array(), 200, array('ETag' => 'foo'));
        
$this->assertSame('application/json'$response->headers->get('Content-Type'));
        
$this->assertSame('foo'$response->headers->get('ETag'));
    }

    public function 
testConstructorWithCustomContentType()
    {
        
$headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');

        
$response = new JsonResponse(array(), 200$headers);
        
$this->assertSame('application/vnd.acme.blog-v1+json'$response->headers->get('Content-Type'));
    }

    public function 
testCreate()
    {
        
$response JsonResponse::create(array('foo' => 'bar'), 204);

        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertEquals('{"foo":"bar"}'$response->getContent());
        
$this->assertEquals(204$response->getStatusCode());
    }

    public function 
testStaticCreateEmptyJsonObject()
    {
        
$response JsonResponse::create();
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('{}'$response->getContent());
    }

    public function 
testStaticCreateJsonArray()
    {
        
$response JsonResponse::create(array(0123));
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('[0,1,2,3]'$response->getContent());
    }

    public function 
testStaticCreateJsonObject()
    {
        
$response JsonResponse::create(array('foo' => 'bar'));
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('{"foo":"bar"}'$response->getContent());
    }

    public function 
testStaticCreateWithSimpleTypes()
    {
        
$response JsonResponse::create('foo');
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('"foo"'$response->getContent());

        
$response JsonResponse::create(0);
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('0'$response->getContent());

        
$response JsonResponse::create(0.1);
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('0.1'$response->getContent());

        
$response JsonResponse::create(true);
        
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse'$response);
        
$this->assertSame('true'$response->getContent());
    }

    public function 
testStaticCreateWithCustomStatus()
    {
        
$response JsonResponse::create(array(), 202);
        
$this->assertSame(202$response->getStatusCode());
    }

    public function 
testStaticCreateAddsContentTypeHeader()
    {
        
$response JsonResponse::create();
        
$this->assertSame('application/json'$response->headers->get('Content-Type'));
    }

    public function 
testStaticCreateWithCustomHeaders()
    {
        
$response JsonResponse::create(array(), 200, array('ETag' => 'foo'));
        
$this->assertSame('application/json'$response->headers->get('Content-Type'));
        
$this->assertSame('foo'$response->headers->get('ETag'));
    }

    public function 
testStaticCreateWithCustomContentType()
    {
        
$headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');

        
$response JsonResponse::create(array(), 200$headers);
        
$this->assertSame('application/vnd.acme.blog-v1+json'$response->headers->get('Content-Type'));
    }

    public function 
testSetCallback()
    {
        
$response JsonResponse::create(array('foo' => 'bar'))->setCallback('callback');

        
$this->assertEquals('callback({"foo":"bar"});'$response->getContent());
        
$this->assertEquals('text/javascript'$response->headers->get('Content-Type'));
    }

    public function 
testJsonEncodeFlags()
    {
        
$response = new JsonResponse('<>\'&"');

        
$this->assertEquals('"\u003C\u003E\u0027\u0026\u0022"'$response->getContent());
    }

    
/**
     * @expectedException \InvalidArgumentException
     */
    
public function testSetCallbackInvalidIdentifier()
    {
        
$response = new JsonResponse('foo');
        
$response->setCallback('+invalid');
    }

    
/**
     * @expectedException \InvalidArgumentException
     */
    
public function testSetContent()
    {
        
JsonResponse::create("\xB1\x31");
    }
}

:: 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.0975 ]--