KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/parasoffline.edukrypt.in/application/vendor/guzzlehttp/guzzle/tests/Post/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/parasoffline.edukrypt.in/application/vendor/guzzlehttp/guzzle/tests/Post/PostFileTest.php
<?php
namespace GuzzleHttp\Tests\Post;

use GuzzleHttp\Post\MultipartBody;
use GuzzleHttp\Post\PostFile;
use GuzzleHttp\Stream\Stream;

/**
 * @covers GuzzleHttp\Post\PostFile
 */
class PostFileTest extends \PHPUnit_Framework_TestCase
{
    public function testCreatesFromString()
    {
        $p = new PostFile('foo', 'hi', '/path/to/test.php');
        $this->assertInstanceOf('GuzzleHttp\Post\PostFileInterface', $p);
        $this->assertEquals('hi', $p->getContent());
        $this->assertEquals('foo', $p->getName());
        $this->assertEquals('/path/to/test.php', $p->getFilename());
        $this->assertEquals(
            'form-data; name="foo"; filename="test.php"',
            $p->getHeaders()['Content-Disposition']
        );
    }

    public function testGetsFilenameFromMetadata()
    {
        $p = new PostFile('foo', fopen(__FILE__, 'r'));
        $this->assertEquals(__FILE__, $p->getFilename());
    }

    public function testDefaultsToNameWhenNoFilenameExists()
    {
        $p = new PostFile('foo', 'bar');
        $this->assertEquals('foo', $p->getFilename());
    }

    public function testCreatesFromMultipartFormData()
    {
        $mp = new MultipartBody([], [], 'baz');
        $p = new PostFile('foo', $mp);
        $this->assertEquals(
            'form-data; name="foo"',
            $p->getHeaders()['Content-Disposition']
        );
        $this->assertEquals(
            'multipart/form-data; boundary=baz',
            $p->getHeaders()['Content-Type']
        );
    }

    public function testCanAddHeaders()
    {
        $p = new PostFile('foo', Stream::factory('hi'), 'test.php', [
            'X-Foo' => '123',
            'Content-Disposition' => 'bar'
        ]);
        $this->assertEquals('bar', $p->getHeaders()['Content-Disposition']);
        $this->assertEquals('123', $p->getHeaders()['X-Foo']);
    }
}

Anon7 - 2021