Skip to content

Commit

Permalink
Import root namespace functions & classes, add phpdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
hollodotme committed May 10, 2018
1 parent c39fb15 commit ab68b5d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/Integration/RoundRobinProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use hollodotme\FastCGI\SocketConnections\NetworkSocket;
use hollodotme\FastCGI\SocketConnections\UnixDomainSocket;
use PHPUnit\Framework\TestCase;
use function http_build_query;
use function in_array;
use function usleep;

/**
* Class RoundRobinProxyTest
Expand All @@ -23,6 +26,10 @@ final class RoundRobinProxyTest extends TestCase
{
private const WORKER = __DIR__ . '/Workers/worker.php';

/**
* @throws \PHPUnit\Framework\ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function testCanSendSynchronousRequests() : void
{
$proxy = $this->getProxy();
Expand Down Expand Up @@ -91,6 +98,10 @@ public function testCanWaitForResponse() : void
$proxy->waitForResponse( $requestId2 );
}

/**
* @throws \PHPUnit\Framework\ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function testCanCheckIfProxyHasResponse() : void
{
$proxy = $this->getProxy();
Expand All @@ -115,7 +126,8 @@ public function testCanWaitForResponses() : void
{
$test->assertSame( 'Unit-Test-unix-domain-socket', $response->getBody() );
};
$proxy = $this->getProxy();

$proxy = $this->getProxy();

$proxy->sendAsyncRequest( $this->getRequestWithCallback( $callback1 ) );
$proxy->sendAsyncRequest( $this->getRequestWithCallback( $callback2 ) );
Expand All @@ -137,6 +149,10 @@ private function getRequestWithCallback( \Closure $callback ) : ProvidesRequestD
return $request;
}

/**
* @throws \PHPUnit\Framework\ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function testCanReadResponses() : void
{
$proxy = $this->getProxy();
Expand All @@ -161,6 +177,10 @@ public function testCanReadResponses() : void
$this->assertSame( $expectedResponses, $responses );
}

/**
* @throws \PHPUnit\Framework\ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function testCanReadReadyResponses() : void
{
$proxy = $this->getProxy();
Expand All @@ -178,7 +198,7 @@ public function testCanReadReadyResponses() : void
{
foreach ( $proxy->readReadyResponses() as $response )
{
$this->assertTrue( \in_array( $response->getBody(), $expectedResponses, true ) );
$this->assertTrue( in_array( $response->getBody(), $expectedResponses, true ) );
}
}
}
Expand Down

0 comments on commit ab68b5d

Please sign in to comment.