Merge remote branch 'origin/master'
[phpmyadmin/dkf.git] / test / PMA_whichCrlf_test.php
blob244b548cd22cd2000ea75bc78a18fe5d879bebd0
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test whichCrlf function
6 * @package phpMyAdmin-test
7 * @version $Id: PMA_whichCrlf_test.php
8 */
10 /**
11 * Tests core.
13 require_once 'PHPUnit/Framework.php';
15 /**
16 * Include to test.
18 require_once './libraries/common.inc.php';
20 /**
21 * Test whichCrlf function.
24 class PMA_whichCrlf_test extends PHPUnit_Framework_TestCase
27 /**
28 * @using runkit pecl extension
29 * if not define PMA_USR_OS, then define it as Win
30 * if installed runkit, then constant will not change
33 public function testWhichCrlf()
35 $runkit = function_exists('runkit_constant_redefine');
36 if ($runkit && defined('PMA_USR_OS'))
37 $pma_usr_os = PMA_USR_OS;
39 if (defined('PMA_USR_OS') && !$runkit) {
41 if (PMA_USR_OS == 'Win')
42 $this->assertEquals("\r\n", PMA_whichCrlf());
43 else
44 $this->assertEquals("\n", PMA_whichCrlf());
46 $this->markTestIncomplete('Cannot redefine constant');
48 } else {
50 if ($runkit)
51 define('PMA_USR_OS', 'Linux');
52 $this->assertEquals("\n", PMA_whichCrlf());
54 if ($runkit)
55 runkit_constant_redefine('PMA_USR_OS', 'Win');
56 else
57 define('PMA_USR_OS', 'Win');
58 $this->assertEquals("\r\n", PMA_whichCrlf());
62 if ($runkit) {
63 if (isset($pma_usr_os))
64 runkit_constant_redefine('PMA_USR_OS', 'Win');
65 else
66 runkit_constant_remove('PMA_USR_OS');