Skip to content

Commit

Permalink
zendframework#7095 - removing useless test skipping logic, as we now …
Browse files Browse the repository at this point in the history
…support PHP >=5.4
  • Loading branch information
Ocramius committed Jan 12, 2015
1 parent 94694a4 commit d1c5d9f
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 84 deletions.
4 changes: 0 additions & 4 deletions tests/ZendTest/Code/Generator/ParameterGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
);
Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Code/Reflection/ParameterReflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 0 additions & 3 deletions tests/ZendTest/Code/Scanner/TokenArrayScannerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions tests/ZendTest/Filter/Encrypt/OpensslTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
12 changes: 3 additions & 9 deletions tests/ZendTest/Filter/HtmlEntitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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');

Expand All @@ -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');

Expand Down
4 changes: 0 additions & 4 deletions tests/ZendTest/Json/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
22 changes: 2 additions & 20 deletions tests/ZendTest/Stdlib/CallbackHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions tests/ZendTest/Stdlib/Guard/EmptyGuardTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions tests/ZendTest/Stdlib/Guard/NullGuardTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions tests/ZendTest/View/Renderer/JsonRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) . ');';
Expand Down
6 changes: 2 additions & 4 deletions tests/ZendTest/XmlRpc/ValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit d1c5d9f

Please sign in to comment.