Skip to content

Commit

Permalink
Change: data type
Browse files Browse the repository at this point in the history
  • Loading branch information
viest committed Jan 1, 2021
1 parent a8ac46d commit d3ebbc3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 48 deletions.
33 changes: 11 additions & 22 deletions tests/open_xlsx_global_data_type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ $filePath = $excel->fileName('tutorial.xlsx')
$excel->openFile('tutorial.xlsx')
->setGlobalType(\Vtiful\Kernel\Excel::TYPE_DOUBLE)
->nextCellCallback(function ($row, $cell, $data) {
echo 'cell:' . $cell . ', row:' . $row . PHP_EOL;
var_dump($data);
echo 'cell:' . $cell . ', row:' . $row .', data type:' . gettype($data) . PHP_EOL;
});

echo '----------------' . PHP_EOL;
Expand Down Expand Up @@ -48,26 +47,16 @@ var_dump($excel->nextRow());
@unlink(__DIR__ . '/tutorial.xlsx');
?>
--EXPECT--
cell:0, row:0
string(4) "Item"
cell:1, row:0
string(4) "Cost"
cell:2, row:0
string(3) "Int"
cell:3, row:0
string(6) "Double"
cell:3, row:0
string(12) "XLSX_ROW_END"
cell:0, row:1
string(6) "Item_1"
cell:1, row:1
string(6) "Cost_1"
cell:2, row:1
float(10)
cell:3, row:1
float(10.9999995)
cell:3, row:1
string(12) "XLSX_ROW_END"
cell:0, row:0, data type:string
cell:1, row:0, data type:string
cell:2, row:0, data type:string
cell:3, row:0, data type:string
cell:3, row:0, data type:string
cell:0, row:1, data type:string
cell:1, row:1, data type:string
cell:2, row:1, data type:double
cell:3, row:1, data type:double
cell:3, row:1, data type:string
----------------
array(2) {
[0]=>
Expand Down
39 changes: 13 additions & 26 deletions tests/open_xlsx_next_cell_callback_with_data_type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,23 @@ $excel->openFile('tutorial.xlsx')
\Vtiful\Kernel\Excel::TYPE_TIMESTAMP,
])
->nextCellCallback(function ($row, $cell, $data) {
echo 'cell:' . $cell . ', row:' . $row . PHP_EOL;
var_dump($data);
echo 'cell:' . $cell . ', row:' . $row .', data type:' . gettype($data) . PHP_EOL;
});
?>
--CLEAN--
<?php
@unlink(__DIR__ . '/tutorial.xlsx');
?>
--EXPECT--
cell:0, row:0
string(4) "Item"
cell:1, row:0
string(4) "Cost"
cell:2, row:0
string(3) "Int"
cell:3, row:0
string(6) "Double"
cell:4, row:0
string(4) "Date"
cell:4, row:0
string(12) "XLSX_ROW_END"
cell:0, row:1
string(6) "Item_1"
cell:1, row:1
string(6) "Cost_1"
cell:2, row:1
int(10)
cell:3, row:1
float(10.9999995)
cell:4, row:1
int(1568904314)
cell:4, row:1
string(12) "XLSX_ROW_END"
cell:0, row:0, data type:string
cell:1, row:0, data type:string
cell:2, row:0, data type:string
cell:3, row:0, data type:string
cell:4, row:0, data type:string
cell:4, row:0, data type:string
cell:0, row:1, data type:string
cell:1, row:1, data type:string
cell:2, row:1, data type:integer
cell:3, row:1, data type:double
cell:4, row:1, data type:integer
cell:4, row:1, data type:string

0 comments on commit d3ebbc3

Please sign in to comment.