ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
StringTest.php
Go to the documentation of this file.
1<?php
2
3
4require_once 'testDataFileIterator.php';
5
7{
8
9 public function setUp()
10 {
11 if (!defined('PHPEXCEL_ROOT')) {
12 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
13 }
14 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
15 }
16
17 public function testGetIsMbStringEnabled()
18 {
19 $result = call_user_func(array('PHPExcel_Shared_String','getIsMbstringEnabled'));
20 $this->assertTrue($result);
21 }
22
23 public function testGetIsIconvEnabled()
24 {
25 $result = call_user_func(array('PHPExcel_Shared_String','getIsIconvEnabled'));
26 $this->assertTrue($result);
27 }
28
29 public function testGetDecimalSeparator()
30 {
31 $localeconv = localeconv();
32
33 $expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
34 $result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator'));
35 $this->assertEquals($expectedResult, $result);
36 }
37
38 public function testSetDecimalSeparator()
39 {
40 $expectedResult = ',';
41 $result = call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),$expectedResult);
42
43 $result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator'));
44 $this->assertEquals($expectedResult, $result);
45 }
46
47 public function testGetThousandsSeparator()
48 {
49 $localeconv = localeconv();
50
51 $expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
52 $result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator'));
53 $this->assertEquals($expectedResult, $result);
54 }
55
56 public function testSetThousandsSeparator()
57 {
58 $expectedResult = ' ';
59 $result = call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),$expectedResult);
60
61 $result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator'));
62 $this->assertEquals($expectedResult, $result);
63 }
64
65 public function testGetCurrencyCode()
66 {
67 $localeconv = localeconv();
68
69 $expectedResult = (!empty($localeconv['currency_symbol'])) ? $localeconv['currency_symbol'] : '$';
70 $result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode'));
71 $this->assertEquals($expectedResult, $result);
72 }
73
74 public function testSetCurrencyCode()
75 {
76 $expectedResult = '£';
77 $result = call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),$expectedResult);
78
79 $result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode'));
80 $this->assertEquals($expectedResult, $result);
81 }
82
83}
$result
An exception for terminatinating execution or to throw for unit testing.
testGetDecimalSeparator()
Definition: StringTest.php:29
testSetDecimalSeparator()
Definition: StringTest.php:38
testGetIsIconvEnabled()
Definition: StringTest.php:23
testSetThousandsSeparator()
Definition: StringTest.php:56
testGetThousandsSeparator()
Definition: StringTest.php:47
testSetCurrencyCode()
Definition: StringTest.php:74
testGetCurrencyCode()
Definition: StringTest.php:65
testGetIsMbStringEnabled()
Definition: StringTest.php:17
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27