cvs: pear /PHP_CompatInfo/tests PHP_CompatInfo_TestSuite_Bugs.php

[email protected] ("Laurent Laville") Mon, 12 May 2008 15:43:25 -0000
Newsgroups php.pear.cvs
Message-ID <cvsfarell1210607005@cvsserver>
farell		Mon May 12 15:43:25 2008 UTC

  Modified files:              
    /pear/PHP_CompatInfo/tests	PHP_CompatInfo_TestSuite_Bugs.php 
  Log:
  - now PHP3 is no more supported since release 1.5.0, fix minimum version to 4.0.0 rather than 3.0.0
  - add new test case for bug 13873 about usage of conditional code (see BeehiveForum 0.8.2 distrib)
  
  
http://cvs.php.net/viewvc.cgi/pear/PHP_CompatInfo/tests/PHP_CompatInfo_TestSuite_Bugs.php?r1=1.12&r2=1.13&diff_format=u
Index: pear/PHP_CompatInfo/tests/PHP_CompatInfo_TestSuite_Bugs.php
diff -u pear/PHP_CompatInfo/tests/PHP_CompatInfo_TestSuite_Bugs.php:1.12 pear/PHP_CompatInfo/tests/PHP_CompatInfo_TestSuite_Bugs.php:1.13
--- pear/PHP_CompatInfo/tests/PHP_CompatInfo_TestSuite_Bugs.php:1.12	Thu Apr 17 20:54:49 2008
+++ pear/PHP_CompatInfo/tests/PHP_CompatInfo_TestSuite_Bugs.php	Mon May 12 15:43:25 2008
@@ -8,7 +8,7 @@
  * @package  PHP_CompatInfo
  * @author   Laurent Laville <[email protected]>
  * @license  http://www.php.net/license/3_01.txt  PHP License 3.01
- * @version  CVS: $Id: PHP_CompatInfo_TestSuite_Bugs.php,v 1.12 2008/04/17 20:54:49 farell Exp $
+ * @version  CVS: $Id: PHP_CompatInfo_TestSuite_Bugs.php,v 1.13 2008/05/12 15:43:25 farell Exp $
  * @link     http://pear.php.net/package/PHP_CompatInfo
  * @since    File available since Release 1.6.0
  */
@@ -93,7 +93,7 @@
                      'ignored_extensions' => array(),
                      'ignored_constants' => array(),
                      'max_version' => '',
-                     'version' => '3.0.0',
+                     'version' => '4.0.0',
                      'extensions' => array(),
                      'constants' => array(),
                      'tokens' => array(),
@@ -342,13 +342,117 @@
                      'ignored_extensions' => array(),
                      'ignored_constants' => array(),
                      'max_version' => '',
-                     'version' => '3.0.0',
+                     'version' => '4.0.0',
                      'extensions' => array(),
                      'constants' => array(),
                      'tokens' => array(),
                      'cond_code' => array(0, array()));
         $this->assertSame($exp, $r);
     }
+
+    /**
+     * Regression test for bug #13873
+     *
+     * @return void
+     * @link   http://pear.php.net/bugs/bug.php?id=13873
+     *         PHP_CompatInfo fails to scan if it finds other than encapsed string
+     */
+    public function testBug13873()
+    {
+        $ds  = DIRECTORY_SEPARATOR;
+        $dir = dirname(__FILE__) . $ds . 'beehiveforum082' . $ds . 'forum';
+        $r   = $this->pci->parseFolder($dir);
+        $exp = array (
+          'ignored_files' =>
+          array (
+          ),
+          'ignored_functions' =>
+          array (
+          ),
+          'ignored_extensions' =>
+          array (
+          ),
+          'ignored_constants' =>
+          array (
+          ),
+          'max_version' => '',
+          'version' => '4.0.6',
+          'extensions' =>
+          array (
+            0 => 'pcre',
+            1 => 'date',
+            2 => 'hash',
+          ),
+          'constants' =>
+          array (
+            0 => '__FILE__',
+          ),
+          'tokens' =>
+          array (
+          ),
+          'cond_code' =>
+          array (
+            0 => 4,
+            1 =>
+            array (
+              0 =>
+              array (
+              ),
+              1 =>
+              array (
+              ),
+              2 =>
+              array (
+              ),
+            ),
+          ),
+        $dir . $ds . 'include' . $ds . 'forum.inc.php' =>
+        array (
+          'ignored_functions' =>
+          array (
+          ),
+          'ignored_extensions' =>
+          array (
+          ),
+          'ignored_constants' =>
+          array (
+          ),
+          'max_version' => '',
+          'version' => '4.0.6',
+          'extensions' =>
+          array (
+            0 => 'pcre',
+            1 => 'date',
+            2 => 'hash',
+          ),
+          'constants' =>
+          array (
+            0 => '__FILE__',
+          ),
+          'tokens' =>
+          array (
+          ),
+          'cond_code' =>
+          array (
+            0 => 4,
+            1 =>
+            array (
+              0 =>
+              array (
+              ),
+              1 =>
+              array (
+              ),
+              2 =>
+              array (
+              ),
+            ),
+          ),
+        ),
+
+        );
+        $this->assertSame($exp, $r);
+    }
 }
 
 // Call PHP_CompatInfo_TestSuite_Bugs::main() if file is executed directly.