Skip to content

Commit 2e70313

Browse files
committed
Test: insert date custom format and read data with type
1 parent 81bc959 commit 2e70313

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Check for vtiful presence
3+
--SKIPIF--
4+
<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
$config = [
8+
'path' => './tests'
9+
];
10+
11+
$fileObject = new \Vtiful\Kernel\Excel($config);
12+
$fileObject = $fileObject->fileName('tutorial.xlsx');
13+
14+
$filePath = $fileObject->header(['date'])
15+
->insertDate(1, 0, time(), 'mmm d yyyy hh:mm AM/PM')
16+
->output();
17+
18+
var_dump($filePath);
19+
?>
20+
--CLEAN--
21+
<?php
22+
@unlink(__DIR__ . '/tutorial.xlsx');
23+
?>
24+
--EXPECT--
25+
string(21) "./tests/tutorial.xlsx"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
--TEST--
2+
Check for vtiful presence
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/include/skipif.inc';
6+
skip_disable_reader();
7+
?>
8+
--FILE--
9+
<?php
10+
$config = [
11+
'path' => './tests',
12+
];
13+
14+
$fileObject = new \Vtiful\Kernel\Excel($config);
15+
$fileObject = $fileObject->fileName('tutorial.xlsx');
16+
17+
$filePath = $fileObject->header(['date'])
18+
->insertDate(1, 0, 1568389354, 'mmm d yyyy hh:mm AM/PM')
19+
->output();
20+
21+
$fileObject->openFile('tutorial.xlsx')
22+
->openSheet();
23+
24+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_STRING])); // Header
25+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_TIMESTAMP]));
26+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_TIMESTAMP]));
27+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_TIMESTAMP]));
28+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_TIMESTAMP]));
29+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_TIMESTAMP]));
30+
var_dump($fileObject->nextRow([\Vtiful\Kernel\Excel::TYPE_TIMESTAMP]));
31+
?>
32+
--CLEAN--
33+
<?php
34+
@unlink(__DIR__ . '/tutorial.xlsx');
35+
?>
36+
--EXPECT--
37+
array(1) {
38+
[0]=>
39+
string(4) "date"
40+
}
41+
array(1) {
42+
[0]=>
43+
float(1568389354)
44+
}
45+
NULL
46+
NULL
47+
NULL
48+
NULL
49+
NULL

0 commit comments

Comments
 (0)