NewExcelFileTest.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include_once 'classes/TestExport.php';
include_once 'classes/TestExportHandler.php';
include_once 'classes/TestNewFile.php';
include_once 'classes/TestNewFileHandler.php';
class NewExcelFileTest extends TestCase {
public function testInit()
{
$exporter = app('TestExport');
$this->assertInstanceOf('Maatwebsite\Excel\Files\NewExcelFile', $exporter);
}
public function testGetFilename()
{
$exporter = app('TestExport');
$this->assertEquals('test-file', $exporter->getFilename());
}
public function testCreateNewFile()
{
$exporter = app('TestExport');
$exporter->createNewFile();
$this->assertInstanceOf('Maatwebsite\Excel\Writers\LaravelExcelWriter', $exporter->getFileInstance());
}
public function testDirectUsage()
{
$exporter = app('TestExport');
$exporter->setTitle('New title');
$this->assertEquals('New title', $exporter->getFileInstance()->getTitle());
}
public function testExportHandler()
{
$exporter = app('TestExport');
$result = $exporter->handleExport();
$this->assertEquals('exported', $result);
$exporter = app('TestNewFile');
$result = $exporter->handleExport();
$this->assertEquals('exported', $result);
}
}