Completed
Push — master ( 3c9fbc...80c44a )
by Once
02:12
created

SheetTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
declare(strict_types=1);
4
5
use Zhaqq\Xlsx\Writer\Sheet;
6
7
/**
8
 * Class SheetTest
9
 */
10
class SheetTest extends \PHPUnit\Framework\TestCase
11
{
12
13
    public function testFile()
14
    {
15
        $tempDir = __DIR__ . '/../data/';
16
        $filename = tempnam($tempDir, "xlsx_writer_");
17
        $sheet = new Sheet(
18
            [
19
                'filename' => $filename,
20
                'sheetname' => 'sheet_1',
21
                'xmlname' => 'sheet_1',
22
                'row_count' => 0,
23
                'columns' => [],
24
                'merge_cells' => [],
25
                'max_cell_tag_start' => 0,
26
                'max_cell_tag_end' => 0,
27
                'auto_filter' => false,
28
                'freeze_rows' => false,
29
                'freeze_columns' => false,
30
                'finalized' => false,
31
            ], 'xlsx'
32
        );
33
34
        $sheet->fileWriter->ftell();
35
        $this->assertSame(0, $sheet->fileWriter->ftell());
36
        $string = '';
37
        for($i=0;$i< 10;$i++) {
38
            $string .= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
39
        }
40
        $sheet->fileWriter->write($string);
41
        $this->assertSame(620, $sheet->fileWriter->ftell());
42
    }
43
}
44