Files
faveo/vendor/maatwebsite/excel/tests/Files/ExcelFileTest.php
Manish Verma 76e85db070 update 1.0.8.0
Commits for version update
2016-10-17 12:02:27 +05:30

71 lines
1.8 KiB
PHP

<?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);
}
}