/var/www/hkosl.com/imusiccircle/webadmin/libraies/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Calculation/TextDataTest.php


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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?php


require_once 'testDataFileIterator.php';

class 
TextDataTest extends PHPUnit_Framework_TestCase
{

    public function 
setUp()
    {
        if (!
defined('PHPEXCEL_ROOT'))
        {
            
define('PHPEXCEL_ROOT'APPLICATION_PATH '/');
        }
        require_once(
PHPEXCEL_ROOT 'PHPExcel/Autoloader.php');

        
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
    }

    
/**
     * @dataProvider providerCHAR
     */
    
public function testCHAR()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerCHAR()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data');
    }

    
/**
     * @dataProvider providerCODE
     */
    
public function testCODE()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerCODE()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/CODE.data');
    }

    
/**
     * @dataProvider providerCONCATENATE
     */
    
public function testCONCATENATE()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerCONCATENATE()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data');
    }

    
/**
     * @dataProvider providerLEFT
     */
    
public function testLEFT()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerLEFT()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data');
    }

    
/**
     * @dataProvider providerMID
     */
    
public function testMID()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerMID()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/MID.data');
    }

    
/**
     * @dataProvider providerRIGHT
     */
    
public function testRIGHT()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerRIGHT()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data');
    }

    
/**
     * @dataProvider providerLOWER
     */
    
public function testLOWER()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerLOWER()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data');
    }

    
/**
     * @dataProvider providerUPPER
     */
    
public function testUPPER()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerUPPER()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data');
    }

    
/**
     * @dataProvider providerPROPER
     */
    
public function testPROPER()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerPROPER()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data');
    }

    
/**
     * @dataProvider providerLEN
     */
    
public function testLEN()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerLEN()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/LEN.data');
    }

    
/**
     * @dataProvider providerSEARCH
     */
    
public function testSEARCH()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerSEARCH()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data');
    }

    
/**
     * @dataProvider providerFIND
     */
    
public function testFIND()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerFIND()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/FIND.data');
    }

    
/**
     * @dataProvider providerREPLACE
     */
    
public function testREPLACE()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerREPLACE()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data');
    }

    
/**
     * @dataProvider providerSUBSTITUTE
     */
    
public function testSUBSTITUTE()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerSUBSTITUTE()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data');
    }

    
/**
     * @dataProvider providerTRIM
     */
    
public function testTRIM()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerTRIM()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data');
    }

    
/**
     * @dataProvider providerCLEAN
     */
    
public function testCLEAN()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerCLEAN()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data');
    }

    
/**
     * @dataProvider providerDOLLAR
     */
    
public function testDOLLAR()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerDOLLAR()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data');
    }

    
/**
     * @dataProvider providerFIXED
     */
    
public function testFIXED()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerFIXED()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data');
    }

    
/**
     * @dataProvider providerT
     */
    
public function testT()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerT()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/T.data');
    }

    
/**
     * @dataProvider providerTEXT
     */
    
public function testTEXT()
    {
        
//    Enforce decimal and thousands separator values to UK/US, and currency code to USD
        
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
        
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),',');
        
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');

        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerTEXT()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data');
    }

    
/**
     * @dataProvider providerVALUE
     */
    
public function testVALUE()
    {
        
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
        
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' ');
        
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');

        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args);
        
$this->assertEquals($expectedResult$resultNULL1E-8);
    }

    public function 
providerVALUE()
    {
        return new 
testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
    }

}