3.3.9.1 release
[phpmyadmin/crack.git] / test / PMA_whichCrlf_test.php
blob2a0726a79fd1ec32599a3fe70b3956a6cdcf0979
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test whichCrlf function
6 * @author Michal Biniek <michal@bystrzyca.pl>
7 * @package phpMyAdmin-test
8 * @version $Id: PMA_whichCrlf_test.php
9 */
11 /**
12 * Tests core.
14 require_once 'PHPUnit/Framework.php';
16 /**
17 * Include to test.
19 require_once './libraries/common.inc.php';
21 /**
22 * Test whichCrlf function.
25 class PMA_whichCrlf_test extends PHPUnit_Framework_TestCase
28 /**
29 * @using runkit pecl extension
30 * if not define PMA_USR_OS, then define it as Win
31 * if installed runkit, then constant will not change
34 public function testWhichCrlf()
36 $runkit = function_exists('runkit_constant_redefine');
37 if ($runkit && defined('PMA_USR_OS'))
38 $pma_usr_os = PMA_USR_OS;
40 if (defined('PMA_USR_OS') && !$runkit) {
42 if (PMA_USR_OS == 'Win')
43 $this->assertEquals("\r\n", PMA_whichCrlf());
44 else
45 $this->assertEquals("\n", PMA_whichCrlf());
47 $this->markTestIncomplete('Cannot redefine constant');
49 } else {
51 if ($runkit)
52 define('PMA_USR_OS', 'Linux');
53 $this->assertEquals("\n", PMA_whichCrlf());
55 if ($runkit)
56 runkit_constant_redefine('PMA_USR_OS', 'Win');
57 else
58 define('PMA_USR_OS', 'Win');
59 $this->assertEquals("\r\n", PMA_whichCrlf());
63 if ($runkit) {
64 if (isset($pma_usr_os))
65 runkit_constant_redefine('PMA_USR_OS', 'Win');
66 else
67 runkit_constant_remove('PMA_USR_OS');