From d1c5d9f514d9df5f606c19785e23f77f2c8a7b17 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 11 Jan 2015 21:01:54 +0100 Subject: [PATCH] #7095 - removing useless test skipping logic, as we now support PHP >=5.4 --- .../Code/Generator/ParameterGeneratorTest.php | 4 ---- .../Reflection/ParameterReflectionTest.php | 4 ---- .../Code/Scanner/TokenArrayScannerTest.php | 3 --- tests/ZendTest/Filter/Encrypt/OpensslTest.php | 8 ++----- tests/ZendTest/Filter/HtmlEntitiesTest.php | 12 +++------- tests/ZendTest/Json/JsonTest.php | 4 ---- .../MutableCreationOptionsTraitTest.php | 3 --- tests/ZendTest/Stdlib/CallbackHandlerTest.php | 22 ++----------------- .../ArrayOrTraversableGuardTraitTest.php | 7 ------ .../Stdlib/Guard/EmptyGuardTraitTest.php | 7 ------ .../Stdlib/Guard/NullGuardTraitTest.php | 7 ------ .../View/Renderer/JsonRendererTest.php | 6 ----- tests/ZendTest/XmlRpc/ValueTest.php | 6 ++--- 13 files changed, 9 insertions(+), 84 deletions(-) diff --git a/tests/ZendTest/Code/Generator/ParameterGeneratorTest.php b/tests/ZendTest/Code/Generator/ParameterGeneratorTest.php index f084703e64c..73212d5755b 100644 --- a/tests/ZendTest/Code/Generator/ParameterGeneratorTest.php +++ b/tests/ZendTest/Code/Generator/ParameterGeneratorTest.php @@ -113,10 +113,6 @@ public function testFromReflectionGetWithNativeType() public function testCallableTypeHint() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('`callable` is only supported in PHP >=5.4.0'); - } - $parameter = ParameterGenerator::fromReflection( new ParameterReflection(array('ZendTest\Code\Generator\TestAsset\CallableTypeHintClass', 'foo'), 'bar') ); diff --git a/tests/ZendTest/Code/Reflection/ParameterReflectionTest.php b/tests/ZendTest/Code/Reflection/ParameterReflectionTest.php index 1f0fda6377b..65034ad10f3 100644 --- a/tests/ZendTest/Code/Reflection/ParameterReflectionTest.php +++ b/tests/ZendTest/Code/Reflection/ParameterReflectionTest.php @@ -46,10 +46,6 @@ public function testTypeReturn($param, $type) public function testCallableTypeHint() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('`callable` is only supported in PHP >=5.4.0'); - } - $parameter = new Reflection\ParameterReflection(array('ZendTest\Code\Reflection\TestAsset\CallableTypeHintClass', 'foo'), 'bar'); $this->assertEquals('callable', $parameter->getType()); diff --git a/tests/ZendTest/Code/Scanner/TokenArrayScannerTest.php b/tests/ZendTest/Code/Scanner/TokenArrayScannerTest.php index 202870d5398..be3b48f5f23 100644 --- a/tests/ZendTest/Code/Scanner/TokenArrayScannerTest.php +++ b/tests/ZendTest/Code/Scanner/TokenArrayScannerTest.php @@ -48,9 +48,6 @@ public function testScannerReturnsClassNames() */ public function testScannerReturnsClassNamesForTraits() { - if (version_compare(PHP_VERSION, '5.4', 'lt')) { - $this->markTestSkipped('Skipping; PHP 5.4 or greater is needed'); - } $tokenScanner = new TokenArrayScanner(token_get_all(file_get_contents((__DIR__ . '/../TestAsset/FooTrait.php')))); $classes = $tokenScanner->getClassNames(); $this->assertInternalType('array', $classes); diff --git a/tests/ZendTest/Filter/Encrypt/OpensslTest.php b/tests/ZendTest/Filter/Encrypt/OpensslTest.php index d9038e59083..39454a98664 100644 --- a/tests/ZendTest/Filter/Encrypt/OpensslTest.php +++ b/tests/ZendTest/Filter/Encrypt/OpensslTest.php @@ -74,9 +74,7 @@ public function testBasicOpenssl() */ public function testEncryptionWithDecryptionOpenssl() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } + $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); $filter = new OpensslEncryption(); $filter->setPublicKey(__DIR__ . '/../_files/publickey.pem'); @@ -103,9 +101,7 @@ public function testEncryptionWithDecryptionOpenssl() */ public function testEncryptionWithDecryptionSingleOptionOpenssl() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } + $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); $filter = new OpensslEncryption(); $filter->setPublicKey(__DIR__ . '/../_files/publickey.pem'); diff --git a/tests/ZendTest/Filter/HtmlEntitiesTest.php b/tests/ZendTest/Filter/HtmlEntitiesTest.php index 72348179673..e69c6d48233 100644 --- a/tests/ZendTest/Filter/HtmlEntitiesTest.php +++ b/tests/ZendTest/Filter/HtmlEntitiesTest.php @@ -197,9 +197,7 @@ public function testQuoteStyleQuotesEncodeNone() */ public function testCorrectsForEncodingMismatch() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } + $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); $string = file_get_contents(dirname(__FILE__) . '/_files/latin-1-text.txt'); @@ -217,9 +215,7 @@ public function testCorrectsForEncodingMismatch() */ public function testStripsUnknownCharactersWhenEncodingMismatchDetected() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } + $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); $string = file_get_contents(dirname(__FILE__) . '/_files/latin-1-text.txt'); @@ -237,9 +233,7 @@ public function testStripsUnknownCharactersWhenEncodingMismatchDetected() */ public function testRaisesExceptionIfEncodingMismatchDetectedAndFinalStringIsEmpty() { - if (version_compare(phpversion(), '5.4', '>=')) { - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); - } + $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); $string = file_get_contents(dirname(__FILE__) . '/_files/latin-1-dash-only.txt'); diff --git a/tests/ZendTest/Json/JsonTest.php b/tests/ZendTest/Json/JsonTest.php index 0ad7ca8ffd7..42c8153d789 100644 --- a/tests/ZendTest/Json/JsonTest.php +++ b/tests/ZendTest/Json/JsonTest.php @@ -461,10 +461,6 @@ public function testToJSONSerialization() public function testJsonSerializableWithBuiltinImplementation() { - if (version_compare(PHP_VERSION, '5.4.0', 'lt')) { - $this->markTestSkipped('JsonSerializable does not exist in PHP <5.4.0.'); - } - $encoded = Json\Encoder::encode( new TestAsset\JsonSerializableBuiltinImpl() ); diff --git a/tests/ZendTest/ServiceManager/MutableCreationOptionsTraitTest.php b/tests/ZendTest/ServiceManager/MutableCreationOptionsTraitTest.php index 6ba63bac245..65fe28e33e6 100644 --- a/tests/ZendTest/ServiceManager/MutableCreationOptionsTraitTest.php +++ b/tests/ZendTest/ServiceManager/MutableCreationOptionsTraitTest.php @@ -17,9 +17,6 @@ class MutableCreationOptionsTraitTest extends TestCase public function setUp() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Requires PHP >=5.4.0'); - } $this->stub = $this->getObjectForTrait('Zend\ServiceManager\MutableCreationOptionsTrait'); } diff --git a/tests/ZendTest/Stdlib/CallbackHandlerTest.php b/tests/ZendTest/Stdlib/CallbackHandlerTest.php index 37ddcd4d17f..60016d505ff 100644 --- a/tests/ZendTest/Stdlib/CallbackHandlerTest.php +++ b/tests/ZendTest/Stdlib/CallbackHandlerTest.php @@ -95,26 +95,12 @@ public function testStringCallbackConsistingOfNonStaticMethodShouldRaiseExceptio { $handler = new CallbackHandler('ZendTest\\Stdlib\\SignalHandlers\\InstanceMethod::handler'); - if (version_compare(PHP_VERSION, '5.4.0rc1', '>=')) { - $this->setExpectedException('Zend\Stdlib\Exception\InvalidCallbackException'); - $handler->call(); - } else { - $error = false; - set_error_handler(function ($errno, $errstr) use (&$error) { - $error = true; - }, E_STRICT); - $handler->call(); - restore_error_handler(); - $this->assertTrue($error); - } + $this->setExpectedException('Zend\Stdlib\Exception\InvalidCallbackException'); + $handler->call(); } public function testStringStaticCallbackForPhp54() { - if (version_compare(PHP_VERSION, '5.4.0rc1', '<=')) { - $this->markTestSkipped('Requires PHP 5.4'); - } - $handler = new CallbackHandler('ZendTest\\Stdlib\\SignalHandlers\\InstanceMethod::staticHandler'); $error = false; set_error_handler(function ($errno, $errstr) use (&$error) { @@ -128,10 +114,6 @@ public function testStringStaticCallbackForPhp54() public function testStringStaticCallbackForPhp54WithMoreThan3Args() { - if (version_compare(PHP_VERSION, '5.4.0rc1', '<=')) { - $this->markTestSkipped('Requires PHP 5.4'); - } - $handler = new CallbackHandler('ZendTest\\Stdlib\\SignalHandlers\\InstanceMethod::staticHandler'); $error = false; set_error_handler(function ($errno, $errstr) use (&$error) { diff --git a/tests/ZendTest/Stdlib/Guard/ArrayOrTraversableGuardTraitTest.php b/tests/ZendTest/Stdlib/Guard/ArrayOrTraversableGuardTraitTest.php index b478b391376..15154895cba 100644 --- a/tests/ZendTest/Stdlib/Guard/ArrayOrTraversableGuardTraitTest.php +++ b/tests/ZendTest/Stdlib/Guard/ArrayOrTraversableGuardTraitTest.php @@ -18,13 +18,6 @@ */ class ArrayOrTraversableGuardTraitTest extends TestCase { - public function setUp() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Only valid for php >= 5.4'); - } - } - public function testGuardForArrayOrTraversableThrowsException() { $object = new GuardedObject; diff --git a/tests/ZendTest/Stdlib/Guard/EmptyGuardTraitTest.php b/tests/ZendTest/Stdlib/Guard/EmptyGuardTraitTest.php index 2161d9b2079..ebf3bd475ae 100644 --- a/tests/ZendTest/Stdlib/Guard/EmptyGuardTraitTest.php +++ b/tests/ZendTest/Stdlib/Guard/EmptyGuardTraitTest.php @@ -17,13 +17,6 @@ */ class EmptyGuardTraitTest extends TestCase { - public function setUp() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Only valid for php >= 5.4'); - } - } - public function testGuardAgainstEmptyThrowsException() { $object = new GuardedObject; diff --git a/tests/ZendTest/Stdlib/Guard/NullGuardTraitTest.php b/tests/ZendTest/Stdlib/Guard/NullGuardTraitTest.php index e906ce66b50..c71b1eaf71c 100644 --- a/tests/ZendTest/Stdlib/Guard/NullGuardTraitTest.php +++ b/tests/ZendTest/Stdlib/Guard/NullGuardTraitTest.php @@ -17,13 +17,6 @@ */ class NullGuardTraitTest extends TestCase { - public function setUp() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Only valid for php >= 5.4'); - } - } - public function testGuardAgainstNullThrowsException() { $object = new GuardedObject; diff --git a/tests/ZendTest/View/Renderer/JsonRendererTest.php b/tests/ZendTest/View/Renderer/JsonRendererTest.php index 7bc8862315a..eb1c994ee06 100644 --- a/tests/ZendTest/View/Renderer/JsonRendererTest.php +++ b/tests/ZendTest/View/Renderer/JsonRendererTest.php @@ -125,9 +125,6 @@ public function testRendersNonObjectModelAsJson($model) public function testRendersJsonSerializableModelsAsJson() { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Can only test JsonSerializable models in PHP 5.4.0 and up'); - } $model = new TestAsset\JsonModel; $model->value = array('foo' => 'bar'); $expected = json_encode($model->value); @@ -198,9 +195,6 @@ public function testRendersNonObjectModelAsJsonWithJsonpCallback($model) public function testRendersJsonSerializableModelsAsJsonWithJsonpCallback() { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Can only test JsonSerializable models in PHP 5.4.0 and up'); - } $model = new TestAsset\JsonModel; $model->value = array('foo' => 'bar'); $expected = 'callback(' . json_encode($model->value) . ');'; diff --git a/tests/ZendTest/XmlRpc/ValueTest.php b/tests/ZendTest/XmlRpc/ValueTest.php index ce260b76491..2a51c1ffac8 100644 --- a/tests/ZendTest/XmlRpc/ValueTest.php +++ b/tests/ZendTest/XmlRpc/ValueTest.php @@ -379,10 +379,8 @@ public function testArrayMustContainDataElement(Generator $generator) */ public function testMarshalNilInStructWrappedInArray(Generator $generator) { - if (version_compare(phpversion(), '5.4', '>=')) { - // SimpleXMLElement don't understand NIL - $this->markTestIncomplete('Code to test is not compatible with PHP 5.4'); - } + // SimpleXMLElement don't understand NIL + $this->markTestIncomplete('Code to test is not compatible with PHP 5.4'); AbstractValue::setGenerator($generator); $expected = array(array('id' => '1', 'name' => 'vertebra, caudal', 'description' => null));