From abf2ce0bd1dc4d2057ca487ac8e30c6b8432fcc2 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 25 Jul 2015 21:49:18 +0200 Subject: [PATCH] [tests] Exlude persistent connections tests under PHP 5.3. The get_resource_type() function does not differentiate between normal streams and persistent streams, so we cannot really test this case. --- tests/PHPUnit/PredisConnectionTestCase.php | 8 ++++++++ .../CompositeStreamConnectionTest.php | 20 ++++--------------- .../PhpiredisStreamConnectionTest.php | 20 ++++--------------- .../Connection/StreamConnectionTest.php | 20 ++++--------------- 4 files changed, 20 insertions(+), 48 deletions(-) diff --git a/tests/PHPUnit/PredisConnectionTestCase.php b/tests/PHPUnit/PredisConnectionTestCase.php index 63c71ddd..352c7725 100644 --- a/tests/PHPUnit/PredisConnectionTestCase.php +++ b/tests/PHPUnit/PredisConnectionTestCase.php @@ -484,6 +484,10 @@ abstract class PredisConnectionTestCase extends PredisTestCase */ protected function assertPersistentConnection(NodeConnectionInterface $connection) { + if (version_compare(PHP_VERSION, '5.4.0') < 0 || $this->isHHVM()) { + $this->markTestSkipped('This test does not currently work on HHVM.'); + } + $this->assertSame('persistent stream', get_resource_type($connection->getResource())); } @@ -497,6 +501,10 @@ abstract class PredisConnectionTestCase extends PredisTestCase */ protected function assertNonPersistentConnection(NodeConnectionInterface $connection) { + if (version_compare(PHP_VERSION, '5.4.0') < 0 || $this->isHHVM()) { + $this->markTestSkipped('This test does not currently work on HHVM.'); + } + $this->assertSame('stream', get_resource_type($connection->getResource())); } diff --git a/tests/Predis/Connection/CompositeStreamConnectionTest.php b/tests/Predis/Connection/CompositeStreamConnectionTest.php index 748f0bef..20cbad40 100644 --- a/tests/Predis/Connection/CompositeStreamConnectionTest.php +++ b/tests/Predis/Connection/CompositeStreamConnectionTest.php @@ -41,13 +41,10 @@ class CompositeStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentParameterWithFalseLikeValues() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 0)); $this->assertNonPersistentConnection($connection1); @@ -63,13 +60,10 @@ class CompositeStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentParameterWithTrueLikeValues() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 1)); $this->assertPersistentConnection($connection1); @@ -87,13 +81,10 @@ class CompositeStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentConnectionsToSameNodeShareResource() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => true)); $connection2 = $this->createConnectionWithParams(array('persistent' => true)); @@ -107,13 +98,10 @@ class CompositeStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentConnectionsToSameNodeDoNotShareResourceUsingDifferentPersistentID() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 'conn1')); $connection2 = $this->createConnectionWithParams(array('persistent' => 'conn2')); diff --git a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php index 6815a1e9..a064f4a5 100644 --- a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php @@ -58,13 +58,10 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentParameterWithFalseLikeValues() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 0)); $this->assertNonPersistentConnection($connection1); @@ -80,13 +77,10 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentParameterWithTrueLikeValues() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 1)); $this->assertPersistentConnection($connection1); @@ -104,13 +98,10 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentConnectionsToSameNodeShareResource() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => true)); $connection2 = $this->createConnectionWithParams(array('persistent' => true)); @@ -124,13 +115,10 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentConnectionsToSameNodeDoNotShareResourceUsingDifferentPersistentID() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 'conn1')); $connection2 = $this->createConnectionWithParams(array('persistent' => 'conn2')); diff --git a/tests/Predis/Connection/StreamConnectionTest.php b/tests/Predis/Connection/StreamConnectionTest.php index 1ac77f6f..ccc87964 100644 --- a/tests/Predis/Connection/StreamConnectionTest.php +++ b/tests/Predis/Connection/StreamConnectionTest.php @@ -24,13 +24,10 @@ class StreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentParameterWithFalseLikeValues() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 0)); $this->assertNonPersistentConnection($connection1); @@ -46,13 +43,10 @@ class StreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentParameterWithTrueLikeValues() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 1)); $this->assertPersistentConnection($connection1); @@ -70,13 +64,10 @@ class StreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentConnectionsToSameNodeShareResource() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => true)); $connection2 = $this->createConnectionWithParams(array('persistent' => true)); @@ -90,13 +81,10 @@ class StreamConnectionTest extends PredisConnectionTestCase /** * @group connected + * @requires PHP 5.4 */ public function testPersistentConnectionsToSameNodeDoNotShareResourceUsingDifferentPersistentID() { - if ($this->isHHVM()) { - $this->markTestSkipped('This test does not currently work on HHVM.'); - } - $connection1 = $this->createConnectionWithParams(array('persistent' => 'conn1')); $connection2 = $this->createConnectionWithParams(array('persistent' => 'conn2'));