viest 7 gadi atpakaļ
vecāks
revīzija
6233fb0970
4 mainītis faili ar 89 papildinājumiem un 0 dzēšanām
  1. 23 0
      tests/013.phpt
  2. 26 0
      tests/014.phpt
  3. 23 0
      tests/015.phpt
  4. 17 0
      tests/016.phpt

+ 23 - 0
tests/013.phpt

@@ -0,0 +1,23 @@
+--TEST--
+Check for vtiful presence
+--SKIPIF--
+<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
+--FILE--
+<?php
+$config = ['path' => './tests'];
+$excel = new \Vtiful\Kernel\Excel($config);
+
+$textFile = $excel->fileName("tutorial01.xlsx")
+    ->header(['name', 'age']);
+
+for ($index = 0; $index < 10; $index++) {
+    $textFile->insertText($index+1, 0, 'vikin');
+    $textFile->insertText($index+1, 1, 1000, '#,##0');
+}
+
+$filePath = $textFile->output();
+
+var_dump($filePath);
+?>
+--EXPECT--
+string(23) "./tests/tutorial01.xlsx"

+ 26 - 0
tests/014.phpt

@@ -0,0 +1,26 @@
+--TEST--
+Check for vtiful presence
+--SKIPIF--
+<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
+--FILE--
+<?php
+$config = ['path' => './tests'];
+$excel = new \Vtiful\Kernel\Excel($config);
+
+$freeFile = $excel->fileName("tutorial01.xlsx")
+    ->header(['name', 'money']);
+
+for($index = 1; $index < 10; $index++) {
+    $freeFile->insertText($index, 0, 'vikin');
+    $freeFile->insertText($index, 1, 10);
+}
+
+$freeFile->insertText(12, 0, "Total");
+$freeFile->insertFormula(12, 1, '=SUM(B2:B11)');
+
+$filePath = $freeFile->output();
+
+var_dump($filePath);
+?>
+--EXPECT--
+string(23) "./tests/tutorial01.xlsx"

+ 23 - 0
tests/015.phpt

@@ -0,0 +1,23 @@
+--TEST--
+Check for vtiful presence
+--SKIPIF--
+<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
+--FILE--
+<?php
+$config = ['path' => './tests'];
+$excel = new \Vtiful\Kernel\Excel($config);
+
+$filePath = $excel->fileName("tutorial01.xlsx")
+    ->header(['name', 'age'])
+    ->data([
+        ['one', 10],
+        ['two', 20],
+        ['three', 30],
+    ])
+    ->autoFilter("A1:B3")
+    ->output();
+
+var_dump($filePath);
+?>
+--EXPECT--
+string(23) "./tests/tutorial01.xlsx"

+ 17 - 0
tests/016.phpt

@@ -0,0 +1,17 @@
+--TEST--
+Check for vtiful presence
+--SKIPIF--
+<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
+--FILE--
+<?php
+$config = ['path' => './tests'];
+$excel = new \Vtiful\Kernel\Excel($config);
+
+$filePath = $excel->fileName("tutorial01.xlsx")
+    ->mergeCells('A1:C1', 'Merge cells')
+    ->output();
+
+var_dump($filePath);
+?>
+--EXPECT--
+string(23) "./tests/tutorial01.xlsx"