Translation update done using Pootle.
[phpmyadmin-themes.git] / test / PMA_stringOperations_test.php
blob38aa26bf7ca3131f91e5998e4ed9461036d0626e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for several string operations
6 * @version $Id: PMA_stringOperations_test.php
7 */
9 /**
10 * Tests core.
12 require_once 'PHPUnit/Framework.php';
14 /**
15 * Include to test.
17 require_once './libraries/common.lib.php';
19 /**
20 * Test string operations.
21 * @package phpMyAdmin-test
23 class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
26 /**
27 * temporary variable for globals array
30 protected $tmpGlobals;
32 /**
33 * temporary variable for session array
36 protected $tmpSession;
38 /**
39 * storing globals and session
41 public function setUp() {
43 $this->tmpGlobals = $GLOBALS;
44 $this->tmpSession = $_SESSION;
48 /**
49 * data provider for flipstring test
52 public function flipStringDataProvider() {
53 return array(
54 array('test', "t<br />\ne<br />\ns<br />\nt"),
55 array('te&nbsp;;st', "t<br />\ne<br />\n&nbsp;<br />\n;<br />\ns<br />\nt")
59 /**
60 * test of changing string from horizontal to vertical orientation
61 * @dataProvider flipStringDataProvider
64 public function testFlipString($a, $e) {
65 $this->assertEquals($e, PMA_flipstring($a));
68 /**
69 * data provider for userDir test
72 public function userDirDataProvider() {
73 return array(
74 array('/var/pma_tmp/%u/', "/var/pma_tmp/root/"),
75 array('/home/%u/pma', "/home/root/pma/")
79 /**
80 * test of generating user dir, globals are defined
81 * @dataProvider userDirDataProvider
84 public function testUserDirString($a, $e) {
85 $GLOBALS['cfg']['Server']['user'] = 'root';
87 $this->assertEquals($e, PMA_userDir($a));
90 /**
91 * data provider for replace binary content test
94 public function replaceBinaryContentsDataProvider() {
95 return array(
96 array("\x000", '\00'),
97 array("\x08\x0a\x0d\x1atest", '\b\n\r\Ztest'),
98 array("\ntest", '\ntest')
103 * replace binary contents test
104 * @dataProvider replaceBinaryContentsDataProvider
107 public function testReplaceBinaryContents($a, $e) {
108 $this->assertEquals($e, PMA_replace_binary_contents($a));
112 * data provider for duplicate first newline test
115 public function duplicateFirstNewlineDataProvider() {
116 return array(
117 array('test', 'test'),
118 array("\r\ntest", "\n\r\ntest"),
119 array("\ntest", "\ntest"),
120 array("\n\r\ntest", "\n\r\ntest")
125 * duplicate first newline test
126 * @dataProvider duplicateFirstNewlineDataProvider
129 public function testDuplicateFirstNewline($a, $e) {
130 $this->assertEquals($e, PMA_duplicateFirstNewline($a));