A simple socket server mock.
- php: ^7.2
- symfony/process: ^3.4.43|^4.4.11|^5.0
Through Composer as chubbyphp/chubbyphp-socket-server-mock.
composer require chubbyphp/chubbyphp-socket-server-mock "^1.2"
<?php
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
}
}
Dominik Zogg 2020