PHP code example of chubbyphp / chubbyphp-socket-server-mock

1. Go to this page and download the library: Download chubbyphp/chubbyphp-socket-server-mock library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chubbyphp / chubbyphp-socket-server-mock example snippets




namespace MyProject\Tests\Integration;

use Chubbyphp\SocketServerMock\CreateSocketServerMockTrait;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;

final class SampleTest extends TestCase
{
    use CreateSocketServerMockTrait;

    public function testSample()
    {
        /** @var Process $process */
        $process = $this->createSocketServerMock('0.0.0.0', 3000, [[[
            'input' => 'input',
            'output' => 'output'
        ]]]);

        // run my integration test
    }
}