cvs: pear /Pager/tests pager_test.php

[email protected] ("Lorenzo Alberton")
Newsgroups php.pear.cvs
Message-ID <cvsquipo1208624025@cvsserver>
quipo		Sat Apr 19 16:53:45 2008 UTC

  Modified files:              
    /pear/Pager/tests	pager_test.php 
  Log:
  - handle differences with PHP >= 5.3
  - added multibyte test
  - added test runner
  
http://cvs.php.net/viewvc.cgi/pear/Pager/tests/pager_test.php?r1=1.31&r2=1.32&diff_format=u
Index: pear/Pager/tests/pager_test.php
diff -u pear/Pager/tests/pager_test.php:1.31 pear/Pager/tests/pager_test.php:1.32
--- pear/Pager/tests/pager_test.php:1.31	Wed Mar 26 21:54:10 2008
+++ pear/Pager/tests/pager_test.php	Sat Apr 19 16:53:45 2008
@@ -1,5 +1,5 @@
 <?php
-// $Id: pager_test.php,v 1.31 2008/03/26 21:54:10 quipo Exp $
+// $Id: pager_test.php,v 1.32 2008/04/19 16:53:45 quipo Exp $
 
 require_once 'simple_include.php';
 require_once 'pager_include.php';
@@ -175,6 +175,9 @@
         //$this->assertEqual($expected, $this->pager->_getLinksUrl());
 
         $expected = 'request%5B0%5D=aRequest&amp;escape=%E4%F6%25%3C%3E%2B';
+        if (version_compare(phpversion(), '5.3.0-dev', '>=')) {
+            $expected = 'request%5B0%5D=aRequest&amp;escape=%C3%A4%C3%B6%25%3C%3E%2B';
+        }
         $rendered = $this->pager->_renderLink('', '');
         preg_match('/href="(.*)"/U', $rendered, $matches);
         $actual = str_replace($_SERVER['PHP_SELF'].'?', '', $matches[1]);
@@ -208,6 +211,20 @@
         $actual = str_replace($_SERVER['PHP_SELF'].'?test=', '', $matches[1]);
         $this->assertEqual(urlencode($options['extraVars']['test']), $actual);
     }
+    function testMultibyteJapaneseStrings() {
+        $options = array(
+            'extraVars' => array(
+                'test' => '&#28450;&#23383;',
+            ),
+            'perPage' => 5,
+        );
+        $this->pager =& Pager::factory($options);
+        //$expected = '<a href="'.$_SERVER['PHP_SELF'].'?test=&#27979;&#35797;" title=""></a>';
+        $rendered = $this->pager->_renderLink('', '');
+        preg_match('/href="(.*)"/U', $rendered, $matches);
+        $actual = str_replace($_SERVER['PHP_SELF'].'?test=', '', $matches[1]);
+        $this->assertEqual(urlencode($options['extraVars']['test']), $actual);
+    }
     function testCurrentPage() {
         $options = array(
             'itemData'    => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
@@ -666,4 +683,9 @@
         $this->assertEqual($expected, $this->pager->_getNextLink());
     }
 }
+if (!defined('TEST_RUNNING')) {
+    define('TEST_RUNNING', true);
+    $test = new TestOfPager();
+    $test->run(new HtmlReporter());
+}
 ?>
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.