summaryrefslogtreecommitdiff
path: root/_test/cases/inc/common_cleanText.test.php
blob: 936ed1d7693c1786a3ae3312219dea625fa033b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

require_once DOKU_INC.'inc/init.php';
require_once DOKU_INC.'inc/common.php';

class common_clientIP_test extends UnitTestCase {

    function test_unix(){
        $unix = 'one
                two

                three';

        $this->assertEqual($unix,cleanText($unix));
    }

    function test_win(){
        $unix = 'one
                two

                three';
        $win = 'one
                two

                three';

        $this->assertEqual(bin2hex($unix),'6f6e650a2020202020202020202020202020202074776f0a0a202020202020202020202020202020207468726565');
        $this->assertEqual(bin2hex($win),'6f6e650d0a2020202020202020202020202020202074776f0d0a0d0a202020202020202020202020202020207468726565');
        $this->assertNotEqual($unix,$win);
        $this->assertEqual($unix,cleanText($win));
    }
}

//Setup VIM: ex: et ts=4 :