Skip to content

Commit 685e9cc

Browse files
committed
Test: default format
1 parent 60f447b commit 685e9cc

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
<file md5sum="39f7c511d9019c6815bcf7fd0f7e8224" name="tests/chart_style.phpt" role="test" />
187187
<file md5sum="bfdf9e054f8efd971a65d00eca465f2f" name="tests/chart_title.phpt" role="test" />
188188
<file md5sum="9badb50b14bd81536bafcfefcb5677d6" name="tests/column_index_from_string.phpt" role="test" />
189+
<file name="tests/default_format.phpt" role="test" />
189190
<file md5sum="df2a6af4ced4ea7660a1691d18e75e8c" name="tests/format_align.phpt" role="test" />
190191
<file md5sum="6f9186fb9d8eb2ad4d96d149c97ef5f8" name="tests/format_background.phpt" role="test" />
191192
<file md5sum="c67d20fdc2f1d4b4b429ac905cb4cbf9" name="tests/format_border.phpt" role="test" />

tests/default_format.phpt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--TEST--
2+
Check for vtiful presence
3+
--SKIPIF--
4+
<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
$config = ['path' => './tests'];
8+
$excel = new \Vtiful\Kernel\Excel($config);
9+
10+
$excel->fileName('tutorial.xlsx');
11+
12+
$format = new \Vtiful\Kernel\Format($excel->getHandle());
13+
$colorOneStyle = $format
14+
->fontColor(\Vtiful\Kernel\Format::COLOR_ORANGE)
15+
->border(\Vtiful\Kernel\Format::BORDER_DASH_DOT)
16+
->toResource();
17+
18+
$format = new \Vtiful\Kernel\Format($excel->getHandle());
19+
$colorTwoStyle = $format
20+
->fontColor(\Vtiful\Kernel\Format::COLOR_GREEN)
21+
->toResource();
22+
23+
$filePath = $excel
24+
// Apply the first style as the default
25+
->defaultFormat($colorOneStyle)
26+
->header(['hello', 'xlswriter'])
27+
// Apply the second style as the default style
28+
->defaultFormat($colorTwoStyle)
29+
->data([
30+
['hello', 'xlswriter'],
31+
])
32+
->output();
33+
34+
var_dump($filePath);
35+
?>
36+
--CLEAN--
37+
<?php
38+
@unlink(__DIR__ . '/tutorial.xlsx');
39+
?>
40+
--EXPECT--
41+
string(21) "./tests/tutorial.xlsx"

0 commit comments

Comments
 (0)