Просмотр исходного кода

Merge pull request #312 from akrabat/classfilelocatortest_52

Skip PHP 5.3+ tests when testing with PHP 5.2
Frank Brückner 11 лет назад
Родитель
Сommit
82690f6827
2 измененных файлов с 20 добавлено и 12 удалено
  1. 16 12
      tests/Zend/File/ClassFileLocatorTest.php
  2. 4 0
      tests/Zend/LocaleTest.php

+ 16 - 12
tests/Zend/File/ClassFileLocatorTest.php

@@ -53,23 +53,25 @@ class Zend_File_ClassFileLocatorTest extends PHPUnit_Framework_TestCase
 
     public function testIterationShouldReturnOnlyPhpFiles()
     {
+        if (version_compare(PHP_VERSION, '5.3', 'lt')) {
+            $this->markTestSkipped('Test can only be run under 5.3 or later');
+        }
+
         $locator = new Zend_File_ClassFileLocator(dirname(__FILE__));
         foreach ($locator as $file) {
-            if (version_compare(PHP_VERSION, '5.3', 'lt') && $file->getFileName() == 'MultipleClassesInMultipleNamespaces.php') {
-                continue;
-            }
             $this->assertRegexp('/\.php$/', $file->getFilename());
         }
     }
 
     public function testIterationShouldReturnOnlyPhpFilesContainingClasses()
     {
+        if (version_compare(PHP_VERSION, '5.3', 'lt')) {
+            $this->markTestSkipped('Test can only be run under 5.3 or later');
+        }
+
         $locator = new Zend_File_ClassFileLocator(dirname(__FILE__));
         $found = false;
         foreach ($locator as $file) {
-            if (version_compare(PHP_VERSION, '5.3', 'lt') && $file->getFileName() == 'MultipleClassesInMultipleNamespaces.php') {
-                continue;
-            }
             if (preg_match('/locator-should-skip-this\.php$/', $file->getFilename())) {
                 $found = true;
             }
@@ -79,12 +81,13 @@ class Zend_File_ClassFileLocatorTest extends PHPUnit_Framework_TestCase
 
     public function testIterationShouldReturnInterfaces()
     {
+        if (version_compare(PHP_VERSION, '5.3', 'lt')) {
+            $this->markTestSkipped('Test can only be run under 5.3 or later');
+        }
+
         $locator = new Zend_File_ClassFileLocator(dirname(__FILE__));
         $found = false;
         foreach ($locator as $file) {
-            if (version_compare(PHP_VERSION, '5.3', 'lt') && $file->getFileName() == 'MultipleClassesInMultipleNamespaces.php') {
-                continue;
-            }
             if (preg_match('/LocatorShouldFindThis\.php$/', $file->getFilename())) {
                 $found = true;
             }
@@ -113,12 +116,13 @@ class Zend_File_ClassFileLocatorTest extends PHPUnit_Framework_TestCase
 
     public function testIterationShouldInjectClassInFoundItems()
     {
+        if (version_compare(PHP_VERSION, '5.3', 'lt')) {
+            $this->markTestSkipped('Test can only be run under 5.3 or later');
+        }
+
         $locator = new Zend_File_ClassFileLocator(dirname(__FILE__));
         $found = false;
         foreach ($locator as $file) {
-            if (version_compare(PHP_VERSION, '5.3', 'lt') && $file->getFileName() == 'MultipleClassesInMultipleNamespaces.php') {
-                continue;
-            }
             $classes = $file->getClasses();
             foreach ($classes as $class) {
                 $found = true;

+ 4 - 0
tests/Zend/LocaleTest.php

@@ -893,6 +893,10 @@ class Zend_LocaleTest extends PHPUnit_Framework_TestCase
 
     public function testEachDataFileShouldPresentAsLocaleData()
     {
+        if (version_compare(PHP_VERSION, '5.3.2', 'lt')) {
+            $this->markTestSkipped('ReflectionMethod::setAccessible can only be run under 5.3.2 or later');
+        }
+
         $dir = new DirectoryIterator(
             dirname(__FILE__) . '/../../library/Zend/Locale/Data'
         );