ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
DateTest.php
Go to the documentation of this file.
1 <?php
2 
3 
4 require_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 
40  public function testDateTimeExcelToPHP1900()
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 
64  public function testDateTimePHPToExcel1900()
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 
106  public function testDateTimeExcelToPHP1904()
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 
130  public function testDateTimePHPToExcel1904()
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 }
testIsDateTimeFormatCode()
providerIsDateTimeFormatCode
Definition: DateTest.php:151
testDateTimeFormattedPHPToExcel1900()
providerDateTimeFormattedPHPToExcel1900
Definition: DateTest.php:85
providerDateTimeExcelToPHP1904()
Definition: DateTest.php:122
$result
setUp()
Definition: DateTest.php:9
testDateTimePHPToExcel1904()
providerDateTimePHPToExcel1904
Definition: DateTest.php:130
providerDateTimeFormattedPHPToExcel1900()
Definition: DateTest.php:98
testDateTimeExcelToPHP1904()
providerDateTimeExcelToPHP1904
Definition: DateTest.php:106
const CALENDAR_MAC_1904
Definition: Date.php:41
testDateTimeExcelToPHP1900()
providerDateTimeExcelToPHP1900
Definition: DateTest.php:40
testSetExcelCalendarWithInvalidValue()
Definition: DateTest.php:30
Create styles array
The data for the language used.
providerDateTimeExcelToPHP1900Timezone()
Definition: DateTest.php:183
testSetExcelCalendar()
Definition: DateTest.php:17
providerDateTimePHPToExcel1900()
Definition: DateTest.php:77
const CALENDAR_WINDOWS_1900
constants
Definition: Date.php:40
providerIsDateTimeFormatCode()
Definition: DateTest.php:159
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
providerDateTimePHPToExcel1904()
Definition: DateTest.php:143
testDateTimePHPToExcel1900()
providerDateTimePHPToExcel1900
Definition: DateTest.php:64
testDateTimeExcelToPHP1900Timezone()
providerDateTimeExcelToPHP1900Timezone
Definition: DateTest.php:167
providerDateTimeExcelToPHP1900()
Definition: DateTest.php:56