ExportTest::testSaveFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use tinymeng\spreadsheet\Gateways\Export;
5
6
class ExportTest extends TestCase
7
{
8
    protected $export;
9
10
    protected function setUp(): void
11
    {
12
        parent::setUp();
13
        $this->export = new Export([
14
            'creator' => 'Test Creator',
15
            'autoFilter' => true,
16
            'horizontalCenter' => true,
17
        ]);
18
    }
19
20
    public function testCreateWorkSheet()
21
    {
22
        $this->export->createWorkSheet('TestSheet');
23
        $this->assertEquals('TestSheet', $this->export->workSheet->getTitle());
24
    }
25
26
27
    public function testSaveFile()
28
    {
29
        $pathName = __DIR__ . '/tmp/';
30
        $fileName = $this->export->save('TestSheet', $pathName);
31
        $this->assertTrue(file_exists($fileName));
32
        unlink($fileName);
33
        rmdir($pathName);
34
    }
35
}
36