浏览代码

TEST: Incremental Write

viest 7 年之前
父节点
当前提交
ee8bdb68f1
共有 2 个文件被更改,包括 26 次插入0 次删除
  1. 1 0
      kernel/excel.c
  2. 25 0
      tests/018.phpt

+ 1 - 0
kernel/excel.c

@@ -155,6 +155,7 @@ PHP_METHOD(vtiful_xls, fileName)
 
     ZEND_PARSE_PARAMETERS_START(1, 2)
             Z_PARAM_STR(zs_file_name)
+            Z_PARAM_OPTIONAL
             Z_PARAM_STR(zs_sheet_name)
     ZEND_PARSE_PARAMETERS_END();
 

+ 25 - 0
tests/018.phpt

@@ -0,0 +1,25 @@
+--TEST--
+Check for vtiful presence
+--SKIPIF--
+<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
+--FILE--
+<?php
+$config = ['path' => './tests'];
+$excel = new \Vtiful\Kernel\Excel($config);
+
+$fileObject = $excel->fileName("tutorial01.xlsx");
+
+$fileObject->header(['name', 'age'])
+    ->data([['viest', 21]])
+    ->data([['wjx', 21]]);
+
+$filePath = $fileObject->output();
+
+var_dump($filePath);
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/tutorial01.xlsx');
+?>
+--EXPECT--
+string(23) "./tests/tutorial01.xlsx"