update 1.0.8.0
Commits for version update
This commit is contained in:
70
vendor/maatwebsite/excel/tests/Files/ExcelFileTest.php
vendored
Normal file
70
vendor/maatwebsite/excel/tests/Files/ExcelFileTest.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
include_once 'classes/TestImport.php';
|
||||
include_once 'classes/TestImportHandler.php';
|
||||
include_once 'classes/TestFile.php';
|
||||
include_once 'classes/TestFileHandler.php';
|
||||
|
||||
class ExcelFileTest extends TestCase {
|
||||
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$importer = app('TestImport');
|
||||
$this->assertInstanceOf('Maatwebsite\Excel\Files\ExcelFile', $importer);
|
||||
}
|
||||
|
||||
|
||||
public function testGetFile()
|
||||
{
|
||||
$importer = app('TestImport');
|
||||
$file = $importer->getFile();
|
||||
$exploded = explode('/',$file);
|
||||
$filename = end($exploded);
|
||||
|
||||
$this->assertEquals('test.csv', $filename);
|
||||
}
|
||||
|
||||
|
||||
public function testGetFilters()
|
||||
{
|
||||
$importer = app('TestImport');
|
||||
$this->assertContains('chunk', $importer->getFilters());
|
||||
$this->assertContains('chunk', $importer->getFileInstance()->filters['enabled']);
|
||||
}
|
||||
|
||||
|
||||
public function testLoadFile()
|
||||
{
|
||||
$importer = app('TestImport');
|
||||
$importer->loadFile();
|
||||
$this->assertInstanceOf('Maatwebsite\Excel\Readers\LaravelExcelReader', $importer->getFileInstance());
|
||||
}
|
||||
|
||||
|
||||
public function testGetResultsDirectly()
|
||||
{
|
||||
$importer = app('TestImport');
|
||||
$results = $importer->get();
|
||||
|
||||
$this->assertInstanceOf('Maatwebsite\Excel\Collections\RowCollection', $results);
|
||||
$this->assertCount(5, $results);
|
||||
}
|
||||
|
||||
|
||||
public function testImportHandler()
|
||||
{
|
||||
$importer = app('TestImport');
|
||||
$results = $importer->handleImport();
|
||||
|
||||
$this->assertInstanceOf('Maatwebsite\Excel\Collections\RowCollection', $results);
|
||||
$this->assertCount(5, $results);
|
||||
|
||||
$importer = app('TestFile');
|
||||
$results = $importer->handleImport();
|
||||
|
||||
$this->assertInstanceOf('Maatwebsite\Excel\Collections\RowCollection', $results);
|
||||
$this->assertCount(5, $results);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user