Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
848 florian 1
<?php
2
// $Id$
3
 
4
require_once 'simple_include.php';
5
require_once 'pager_include.php';
6
 
7
class TestOfPagerPOST extends WebTestCase {
8
    var $pager;
9
    var $baseurl;
10
    var $options = array();
11
 
12
    function TestOfPagerPOST($name='Test of Pager with httpMethod="POST"') {
13
        $this->WebTestCase($name);
14
    }
15
    function setUp() {
16
        $this->options = array(
17
            'itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
18
            'perPage'  => 1,
19
            'clearIfVoid' => false,
20
            'httpMethod' => 'POST',
21
        );
22
        //$this->pager = Pager::factory($this->options);
23
        $this->baseurl = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
24
    }
25
    function tearDown() {
26
        unset($this->pager);
27
    }
28
 
29
    function testMultibyteEncoded() {
30
        $test_strings_encoded = array(
31
            'encoded1' => '&#27979;&#35797;',
32
            'encoded2' => '&#50504;&#45397;',
33
        );
34
		$loaded = $this->get($this->baseurl.'/multibyte_post.php');
35
        $this->assertTrue($loaded);
36
        $this->assertResponse(200);
37
        $this->assertTitle('Pager Test: page 1');
38
        $this->assertNoLink('1');
39
        $this->assertLink('2');
40
        $this->assertLink('Next >>');
41
        //$this->showSource();
42
        foreach ($test_strings_encoded as $name => $value) {
43
            $this->assertWantedPattern('/'.$name.'.*'.preg_quote(str_replace('&', '&amp;', $value)).'/Uims');
44
        }
45
    }
46
 
47
    function testMultibytePlain() {
48
        $test_strings_plain = array(
49
            'plain1' => '안녕',
50
            'plain2' => '더보기',
51
//            'plain3' => '이젠 전화도
52
//로 걸면 무료',
53
        );
54
		$loaded = $this->get($this->baseurl.'/multibyte_post.php');
55
        $this->assertTrue($loaded);
56
        $this->assertResponse(200);
57
        $this->assertTitle('Pager Test: page 1');
58
        $this->assertNoLink('1');
59
        $this->assertLink('2');
60
        $this->assertLink('Next >>');
61
        //$this->showSource();
62
        foreach ($test_strings_plain as $name => $value) {
63
            $this->assertWantedPattern('/'.$name.'.*'.preg_quote(urlencode($value)).'/Uims');
64
        }
65
    }
66
}
67
?>