Browse Source

Test: read cell by callback

viest 5 years ago
parent
commit
5176a92fc2
2 changed files with 34 additions and 1 deletions
  1. 1 1
      .travis.yml
  2. 33 0
      tests/open_xlsx_next_cell_callback.phpt

+ 1 - 1
.travis.yml

@@ -29,7 +29,7 @@ notifications:
 before_script:
   - git submodule update --init
   - sudo apt-get install zlib1g-dev -y
-  - phpize && ./configure && make clean && make
+  - phpize && ./configure --enable-reader && make clean && make
 
 branches:
   only:

+ 33 - 0
tests/open_xlsx_next_cell_callback.phpt

@@ -0,0 +1,33 @@
+--TEST--
+Check for vtiful presence
+--SKIPIF--
+<?php
+require __DIR__ . '/include/skipif.inc';
+skip_disable_reader();
+?>
+--FILE--
+<?php
+$config   = ['path' => './tests'];
+$excel    = new \Vtiful\Kernel\Excel($config);
+$filePath = $excel->fileName('tutorial.xlsx')
+    ->header(['Item', 'Cost'])
+    ->data([
+        ['Item_1', 'Cost_1'],
+    ])
+    ->output();
+
+$excel->openFile('tutorial.xlsx')->nextCellCallback(function ($row, $cell, $data) {
+    echo 'cell:' . $cell . ', row:' . $row . ', value:' . $data . PHP_EOL;
+});
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/tutorial.xlsx');
+?>
+--EXPECT--
+cell:1, row:1, value:Item
+cell:2, row:1, value:Cost
+cell:2, row:1, value:XLSX_ROW_END
+cell:1, row:2, value:Item_1
+cell:2, row:2, value:Cost_1
+cell:2, row:2, value:XLSX_ROW_END