Update Writer folder structure to match Reader new structure

This commit is contained in:
Adrien Loison committed 2015-07-26 23:53:17 -07:00
1 parent c52dd7bde8
commit c672558a18
16 files changed
+81 -76

No files matched your search

@@ -1,16 +1,17 @@
<?php
namespace Box\Spout\Writer;
namespace Box\Spout\Writer\CSV;
use Box\Spout\Common\Type;
use Box\Spout\TestUsingResource;
use Box\Spout\Writer\WriterFactory;
/**
* Class CSVTest
* Class WriterTest
*
* @package Box\Spout\Writer
* @package Box\Spout\Writer\CSV
*/
class CSVTest extends \PHPUnit_Framework_TestCase
class WriterTest extends \PHPUnit_Framework_TestCase
{
use TestUsingResource;
@@ -69,7 +70,7 @@ class CSVTest extends \PHPUnit_Framework_TestCase
];
$writtenContent = $this->writeToCsvFileAndReturnWrittenContent($allRows, 'csv_with_utf8_bom.csv');
$this->assertContains(CSV::UTF8_BOM, $writtenContent, 'The CSV file should contain a UTF-8 BOM');
$this->assertContains(Writer::UTF8_BOM, $writtenContent, 'The CSV file should contain a UTF-8 BOM');
}
/**
@@ -161,6 +162,6 @@ class CSVTest extends \PHPUnit_Framework_TestCase
private function trimWrittenContent($writtenContent)
{
// remove line feeds and UTF-8 BOM
return trim($writtenContent, PHP_EOL . CSV::UTF8_BOM);
return trim($writtenContent, PHP_EOL . Writer::UTF8_BOM);
}
}
@@ -1,11 +1,11 @@
<?php
namespace Box\Spout\Writer\Helper\XLSX;
namespace Box\Spout\Writer\XLSX\Helper;
/**
* Class CellHelperTest
*
* @package Box\Spout\Writer\Helper\XLSX
* @package Box\Spout\Writer\XLSX\Helper
*/
class CellHelperTest extends \PHPUnit_Framework_TestCase
{
@@ -1,14 +1,15 @@
<?php
namespace Box\Spout\Writer;
namespace Box\Spout\Writer\XLSX;
use Box\Spout\Common\Type;
use Box\Spout\TestUsingResource;
use Box\Spout\Writer\WriterFactory;
/**
* Class SheetTest
*
* @package Box\Spout\Writer
* @package Box\Spout\Writer\XLSX
*/
class SheetTest extends \PHPUnit_Framework_TestCase
{
@@ -69,7 +70,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase
$this->createGeneratedFolderIfNeeded($fileName);
$resourcePath = $this->getGeneratedResourcePath($fileName);
/** @var \Box\Spout\Writer\XLSX $writer */
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
$writer = WriterFactory::create(Type::XLSX);
$writer->openToFile($resourcePath);
@@ -1,16 +1,17 @@
<?php
namespace Box\Spout\Writer;
namespace Box\Spout\Writer\XLSX;
use Box\Spout\Common\Type;
use Box\Spout\TestUsingResource;
use Box\Spout\Writer\WriterFactory;
/**
* Class XLSXTest
*
* @package Box\Spout\Writer
*/
class XLSXTest extends \PHPUnit_Framework_TestCase
class WriterTest extends \PHPUnit_Framework_TestCase
{
use TestUsingResource;
@@ -230,7 +231,7 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
$this->createGeneratedFolderIfNeeded($fileName);
$resourcePath = $this->getGeneratedResourcePath($fileName);
/** @var \Box\Spout\Writer\XLSX $writer */
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
$writer = WriterFactory::create(Type::XLSX);
$writer->setShouldUseInlineStrings(true);
@@ -278,7 +279,7 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
];
// set the maxRowsPerSheet limit to 2
\ReflectionHelper::setStaticValue('\Box\Spout\Writer\Internal\XLSX\Workbook', 'maxRowsPerWorksheet', 2);
\ReflectionHelper::setStaticValue('\Box\Spout\Writer\XLSX\Internal\Workbook', 'maxRowsPerWorksheet', 2);
$writer = $this->writeToXLSXFile($dataRows, $fileName, true, $shouldCreateSheetsAutomatically = true);
$this->assertEquals(2, count($writer->getSheets()), '2 sheets should have been created.');
@@ -302,7 +303,7 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
];
// set the maxRowsPerSheet limit to 2
\ReflectionHelper::setStaticValue('\Box\Spout\Writer\Internal\XLSX\Workbook', 'maxRowsPerWorksheet', 2);
\ReflectionHelper::setStaticValue('\Box\Spout\Writer\XLSX\Internal\Workbook', 'maxRowsPerWorksheet', 2);
$writer = $this->writeToXLSXFile($dataRows, $fileName, true, $shouldCreateSheetsAutomatically = false);
$this->assertEquals(1, count($writer->getSheets()), 'Only 1 sheet should have been created.');
@@ -348,14 +349,14 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
* @param string $fileName
* @param bool $shouldUseInlineStrings
* @param bool $shouldCreateSheetsAutomatically
* @return XLSX
* @return Writer
*/
private function writeToXLSXFile($allRows, $fileName, $shouldUseInlineStrings = true, $shouldCreateSheetsAutomatically = true)
{
$this->createGeneratedFolderIfNeeded($fileName);
$resourcePath = $this->getGeneratedResourcePath($fileName);
/** @var \Box\Spout\Writer\XLSX $writer */
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
$writer = WriterFactory::create(Type::XLSX);
$writer->setShouldUseInlineStrings($shouldUseInlineStrings);
$writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);
@@ -373,14 +374,14 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
* @param string $fileName
* @param bool $shouldUseInlineStrings
* @param bool $shouldCreateSheetsAutomatically
* @return XLSX
* @return Writer
*/
private function writeToMultipleSheetsInXLSXFile($allRows, $numSheets, $fileName, $shouldUseInlineStrings = true, $shouldCreateSheetsAutomatically = true)
{
$this->createGeneratedFolderIfNeeded($fileName);
$resourcePath = $this->getGeneratedResourcePath($fileName);
/** @var \Box\Spout\Writer\XLSX $writer */
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
$writer = WriterFactory::create(Type::XLSX);
$writer->setShouldUseInlineStrings($shouldUseInlineStrings);
$writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);