ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
DateTest.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 testSetExcelCalendar()
18 {
19 $calendarValues = array(
22 );
23
24 foreach($calendarValues as $calendarValue) {
25 $result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$calendarValue);
26 $this->assertTrue($result);
27 }
28 }
29
31 {
32 $unsupportedCalendar = '2012';
33 $result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$unsupportedCalendar);
34 $this->assertFalse($result);
35 }
36
41 {
42 $result = call_user_func(
43 array('PHPExcel_Shared_Date','setExcelCalendar'),
45 );
46
47 $args = func_get_args();
48 $expectedResult = array_pop($args);
49 if ($args[0] < 1) {
50 $expectedResult += gmmktime(0,0,0);
51 }
52 $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
53 $this->assertEquals($expectedResult, $result);
54 }
55
57 {
58 return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900.data');
59 }
60
65 {
66 $result = call_user_func(
67 array('PHPExcel_Shared_Date','setExcelCalendar'),
69 );
70
71 $args = func_get_args();
72 $expectedResult = array_pop($args);
73 $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args);
74 $this->assertEquals($expectedResult, $result, NULL, 1E-5);
75 }
76
78 {
79 return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1900.data');
80 }
81
86 {
87 $result = call_user_func(
88 array('PHPExcel_Shared_Date','setExcelCalendar'),
90 );
91
92 $args = func_get_args();
93 $expectedResult = array_pop($args);
94 $result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'),$args);
95 $this->assertEquals($expectedResult, $result, NULL, 1E-5);
96 }
97
99 {
100 return new testDataFileIterator('rawTestData/Shared/DateTimeFormattedPHPToExcel1900.data');
101 }
102
107 {
108 $result = call_user_func(
109 array('PHPExcel_Shared_Date','setExcelCalendar'),
111 );
112
113 $args = func_get_args();
114 $expectedResult = array_pop($args);
115 if ($args[0] < 1) {
116 $expectedResult += gmmktime(0,0,0);
117 }
118 $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
119 $this->assertEquals($expectedResult, $result);
120 }
121
123 {
124 return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1904.data');
125 }
126
131 {
132 $result = call_user_func(
133 array('PHPExcel_Shared_Date','setExcelCalendar'),
135 );
136
137 $args = func_get_args();
138 $expectedResult = array_pop($args);
139 $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args);
140 $this->assertEquals($expectedResult, $result, NULL, 1E-5);
141 }
142
144 {
145 return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1904.data');
146 }
147
151 public function testIsDateTimeFormatCode()
152 {
153 $args = func_get_args();
154 $expectedResult = array_pop($args);
155 $result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'),$args);
156 $this->assertEquals($expectedResult, $result);
157 }
158
160 {
161 return new testDataFileIterator('rawTestData/Shared/DateTimeFormatCodes.data');
162 }
163
168 {
169 $result = call_user_func(
170 array('PHPExcel_Shared_Date','setExcelCalendar'),
172 );
173
174 $args = func_get_args();
175 $expectedResult = array_pop($args);
176 if ($args[0] < 1) {
177 $expectedResult += gmmktime(0,0,0);
178 }
179 $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args);
180 $this->assertEquals($expectedResult, $result);
181 }
182
184 {
185 return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data');
186 }
187
188}
$result
An exception for terminatinating execution or to throw for unit testing.
testIsDateTimeFormatCode()
@dataProvider providerIsDateTimeFormatCode
Definition: DateTest.php:151
providerDateTimeExcelToPHP1900()
Definition: DateTest.php:56
setUp()
Definition: DateTest.php:9
testDateTimeExcelToPHP1900()
@dataProvider providerDateTimeExcelToPHP1900
Definition: DateTest.php:40
testDateTimePHPToExcel1904()
@dataProvider providerDateTimePHPToExcel1904
Definition: DateTest.php:130
testDateTimeFormattedPHPToExcel1900()
@dataProvider providerDateTimeFormattedPHPToExcel1900
Definition: DateTest.php:85
providerDateTimeExcelToPHP1904()
Definition: DateTest.php:122
testDateTimeExcelToPHP1904()
@dataProvider providerDateTimeExcelToPHP1904
Definition: DateTest.php:106
testDateTimeExcelToPHP1900Timezone()
@dataProvider providerDateTimeExcelToPHP1900Timezone
Definition: DateTest.php:167
providerDateTimeExcelToPHP1900Timezone()
Definition: DateTest.php:183
testSetExcelCalendarWithInvalidValue()
Definition: DateTest.php:30
testDateTimePHPToExcel1900()
@dataProvider providerDateTimePHPToExcel1900
Definition: DateTest.php:64
providerDateTimePHPToExcel1904()
Definition: DateTest.php:143
providerDateTimeFormattedPHPToExcel1900()
Definition: DateTest.php:98
providerIsDateTimeFormatCode()
Definition: DateTest.php:159
testSetExcelCalendar()
Definition: DateTest.php:17
providerDateTimePHPToExcel1900()
Definition: DateTest.php:77
const CALENDAR_MAC_1904
Definition: Date.php:41
const CALENDAR_WINDOWS_1900
constants
Definition: Date.php:40
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27