blob: 255c43de669a35a2fea00993967ae034a16253d5 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test PMA_Util::whichCrlf function
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
/**
* Test PMA_Util::whichCrlf function
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
class PMA_WhichCrlf_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for whichCrlf
*
* @return void
*
* @using runkit pecl extension
* if not define PMA_USR_OS, then define it as Win
* if installed runkit, then constant will not change
*/
public function testWhichCrlf()
{
if (PMA_HAS_RUNKIT && defined('PMA_USR_OS')) {
$pma_usr_os = PMA_USR_OS;
}
if (defined('PMA_USR_OS') && !PMA_HAS_RUNKIT) {
if (PMA_USR_OS == 'Win') {
$this->assertEquals(
"\r\n", PMA_Util::whichCrlf()
);
} else {
$this->assertEquals(
"\n", PMA_Util::whichCrlf()
);
}
$this->markTestIncomplete('Cannot redefine constant');
} else {
if (PMA_HAS_RUNKIT) {
if (!defined('PMA_USR_OS')) {
define('PMA_USR_OS', 'Linux');
} else {
runkit_constant_redefine('PMA_USR_OS', 'Linux');
}
$this->assertEquals(
"\n", PMA_Util::whichCrlf()
);
}
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine('PMA_USR_OS', 'Win');
} else {
define('PMA_USR_OS', 'Win');
}
$this->assertEquals(
"\r\n", PMA_Util::whichCrlf()
);
}
if (PMA_HAS_RUNKIT) {
if (isset($pma_usr_os)) {
runkit_constant_redefine('PMA_USR_OS', 'Win');
} else {
runkit_constant_remove('PMA_USR_OS');
}
}
}
}
?>
|