Passed
Push — master ( 88ba49...d8dd24 )
by ma
02:11
created

ExportTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testSaveFile() 0 7 1
A testCreateWorkSheet() 0 4 1
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