mirror of
https://github.com/predis/predis.git
synced 2026-10-09 21:38:07 +00:00
No need for socket_import_stream() to set TCP_NODELAY since PHP 7.1.
This commit is contained in:
@@ -132,4 +132,46 @@ class StreamConnectionTest extends PredisConnectionTestCase
|
||||
|
||||
$this->assertNotSame($connection1->getResource(), $connection2->getResource());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
*/
|
||||
public function testTcpNodelayParameterSetsContextFlagWhenTrue()
|
||||
{
|
||||
$connection = $this->createConnectionWithParams(['tcp_nodelay' => true]);
|
||||
$options = stream_context_get_options($connection->getResource());
|
||||
|
||||
$this->assertIsArray($options);
|
||||
$this->assertArrayHasKey('socket', $options);
|
||||
$this->assertArrayHasKey('tcp_nodelay', $options['socket']);
|
||||
$this->assertTrue($options['socket']['tcp_nodelay']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
*/
|
||||
public function testTcpNodelayParameterDoesNotSetContextFlagWhenFalse()
|
||||
{
|
||||
$connection = $this->createConnectionWithParams(['tcp_nodelay' => false]);
|
||||
$options = stream_context_get_options($connection->getResource());
|
||||
|
||||
$this->assertIsArray($options);
|
||||
$this->assertArrayHasKey('socket', $options);
|
||||
$this->assertArrayHasKey('tcp_nodelay', $options['socket']);
|
||||
$this->assertFalse($options['socket']['tcp_nodelay']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
*/
|
||||
public function testTcpDelayContextFlagIsNotSetByDefault()
|
||||
{
|
||||
$connection = $this->createConnectionWithParams([]);
|
||||
$options = stream_context_get_options($connection->getResource());
|
||||
|
||||
$this->assertIsArray($options);
|
||||
$this->assertArrayHasKey('socket', $options);
|
||||
$this->assertArrayHasKey('tcp_nodelay', $options['socket']);
|
||||
$this->assertFalse($options['socket']['tcp_nodelay']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user