rename EntityFactory for writers and readers #526
This commit is contained in:
1 parent
e1acdc1fc5
commit
8a1c48b6b0
18 files changed
+97
-97
No files matched your search
@@ -4,7 +4,7 @@ namespace Box\Spout\Writer\XLSX;
|
||||
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Exception\InvalidSheetNameException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
@@ -66,7 +66,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$customSheetName = 'Sheet name';
|
||||
@@ -105,7 +105,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$sheet = $writer->getCurrentSheet();
|
||||
@@ -127,7 +127,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$writer->addRow($this->createRowFromValues(['xlsx--sheet1--11', 'xlsx--sheet1--12']));
|
||||
@@ -149,7 +149,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$sheet = $writer->getCurrentSheet();
|
||||
|
||||
@@ -8,7 +8,7 @@ use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Exception\SpoutException;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
@@ -34,7 +34,7 @@ class WriterTest extends TestCase
|
||||
$this->createUnwritableFolderIfNeeded();
|
||||
$filePath = $this->getGeneratedUnwritableResourcePath($fileName);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
@$writer->openToFile($filePath);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class WriterTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->addRow($this->createRowFromValues(['xlsx--11', 'xlsx--12']));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class WriterTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->addRows($this->createRowsFromValues([['xlsx--11', 'xlsx--12']]));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class WriterTest extends TestCase
|
||||
$filePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($filePath);
|
||||
|
||||
$writer->setTempFolder('');
|
||||
@@ -88,7 +88,7 @@ class WriterTest extends TestCase
|
||||
$filePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($filePath);
|
||||
|
||||
$writer->setShouldUseInlineStrings(true);
|
||||
@@ -105,7 +105,7 @@ class WriterTest extends TestCase
|
||||
$filePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($filePath);
|
||||
|
||||
$writer->setShouldCreateNewSheetsAutomatically(true);
|
||||
@@ -159,7 +159,7 @@ class WriterTest extends TestCase
|
||||
$tempFolderPath = $this->getTempFolderPath();
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->setTempFolder($tempFolderPath);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
@@ -184,7 +184,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($resourcePath);
|
||||
$writer->addNewSheetAndMakeItCurrent();
|
||||
$writer->close();
|
||||
@@ -204,7 +204,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$writer->addNewSheetAndMakeItCurrent();
|
||||
@@ -227,7 +227,7 @@ class WriterTest extends TestCase
|
||||
$this->createGeneratedFolderIfNeeded($fileName);
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->close(); // This call should not cause any error
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
@@ -405,7 +405,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->setShouldUseInlineStrings(true);
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
@@ -545,7 +545,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->setShouldUseInlineStrings($shouldUseInlineStrings);
|
||||
$writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);
|
||||
|
||||
@@ -570,7 +570,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->setShouldUseInlineStrings($shouldUseInlineStrings);
|
||||
$writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\Style\BorderBuilder;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
@@ -45,7 +45,7 @@ class WriterWithStyleTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->addRow($this->createStyledRowFromValues(['xlsx--11', 'xlsx--12'], $this->defaultStyle));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class WriterWithStyleTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->addRow($this->createStyledRowFromValues(['xlsx--11', 'xlsx--12'], $this->defaultStyle));
|
||||
}
|
||||
|
||||
@@ -262,10 +262,10 @@ class WriterWithStyleTest extends TestCase
|
||||
$boldStyle = (new StyleBuilder())->setFontBold()->build();
|
||||
$underlineStyle = (new StyleBuilder())->setFontUnderline()->build();
|
||||
|
||||
$dataRow = EntityFactory::createRow([
|
||||
EntityFactory::createCell('xlsx--11', $boldStyle),
|
||||
EntityFactory::createCell('xlsx--12', $underlineStyle),
|
||||
EntityFactory::createCell('xlsx--13', $underlineStyle),
|
||||
$dataRow = WriterEntityFactory::createRow([
|
||||
WriterEntityFactory::createCell('xlsx--11', $boldStyle),
|
||||
WriterEntityFactory::createCell('xlsx--12', $underlineStyle),
|
||||
WriterEntityFactory::createCell('xlsx--13', $underlineStyle),
|
||||
]);
|
||||
|
||||
$this->writeToXLSXFile([$dataRow], $fileName);
|
||||
@@ -519,7 +519,7 @@ class WriterWithStyleTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->setShouldUseInlineStrings(true);
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
@@ -541,7 +541,7 @@ class WriterWithStyleTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::XLSX);
|
||||
$writer = WriterEntityFactory::createWriter(Type::XLSX);
|
||||
$writer->setShouldUseInlineStrings(true);
|
||||
$writer->setDefaultRowStyle($defaultStyle);
|
||||
|
||||
|
||||
Reference in new issue
Block a user