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\ODS;
|
||||
|
||||
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\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$customSheetName = 'Sheet name';
|
||||
@@ -105,7 +105,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$sheet = $writer->getCurrentSheet();
|
||||
@@ -125,7 +125,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$writer->addRow($this->createRowFromValues(['ods--sheet1--11', 'ods--sheet1--12']));
|
||||
@@ -147,7 +147,7 @@ class SheetTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$sheet = $writer->getCurrentSheet();
|
||||
|
||||
@@ -9,7 +9,7 @@ use Box\Spout\Common\Exception\SpoutException;
|
||||
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\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::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
@$writer->openToFile($filePath);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class WriterTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->addRow($this->createRowFromValues(['ods--11', 'ods--12']));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class WriterTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->addRows([$this->createRowFromValues(['ods--11', 'ods--12'])]);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class WriterTest extends TestCase
|
||||
$filePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($filePath);
|
||||
|
||||
$writer->setTempFolder('');
|
||||
@@ -88,7 +88,7 @@ class WriterTest extends TestCase
|
||||
$filePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($filePath);
|
||||
|
||||
$writer->setShouldCreateNewSheetsAutomatically(true);
|
||||
@@ -127,7 +127,7 @@ class WriterTest extends TestCase
|
||||
$tempFolderPath = $this->getTempFolderPath();
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->setTempFolder($tempFolderPath);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
@@ -152,7 +152,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
$writer->addNewSheetAndMakeItCurrent();
|
||||
$writer->close();
|
||||
@@ -172,7 +172,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$writer->addNewSheetAndMakeItCurrent();
|
||||
@@ -195,7 +195,7 @@ class WriterTest extends TestCase
|
||||
$this->createGeneratedFolderIfNeeded($fileName);
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->close(); // This call should not cause any error
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
@@ -350,7 +350,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
$writer->addRows($dataRowsSheet1);
|
||||
@@ -486,7 +486,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
@@ -509,7 +509,7 @@ class WriterTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
@@ -9,9 +9,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\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -42,7 +42,7 @@ class WriterWithStyleTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->addRow($this->createStyledRowFromValues(['ods--11', 'ods--12'], $this->defaultStyle));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class WriterWithStyleTest extends TestCase
|
||||
{
|
||||
$this->expectException(WriterNotOpenedException::class);
|
||||
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->addRow($this->createStyledRowFromValues(['ods--11', 'ods--12'], $this->defaultStyle));
|
||||
}
|
||||
|
||||
@@ -215,10 +215,10 @@ class WriterWithStyleTest extends TestCase
|
||||
$boldStyle = (new StyleBuilder())->setFontBold()->build();
|
||||
$underlineStyle = (new StyleBuilder())->setFontUnderline()->build();
|
||||
|
||||
$dataRow = EntityFactory::createRow([
|
||||
EntityFactory::createCell('ods--11', $boldStyle),
|
||||
EntityFactory::createCell('ods--12', $underlineStyle),
|
||||
EntityFactory::createCell('ods--13', $underlineStyle),
|
||||
$dataRow = WriterEntityFactory::createRow([
|
||||
WriterEntityFactory::createCell('ods--11', $boldStyle),
|
||||
WriterEntityFactory::createCell('ods--12', $underlineStyle),
|
||||
WriterEntityFactory::createCell('ods--13', $underlineStyle),
|
||||
]);
|
||||
|
||||
$this->writeToODSFile([$dataRow], $fileName);
|
||||
@@ -347,7 +347,7 @@ class WriterWithStyleTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
$writer->addRows($allRows);
|
||||
@@ -368,7 +368,7 @@ class WriterWithStyleTest extends TestCase
|
||||
$resourcePath = $this->getGeneratedResourcePath($fileName);
|
||||
|
||||
/** @var \Box\Spout\Writer\ODS\Writer $writer */
|
||||
$writer = EntityFactory::createWriter(Type::ODS);
|
||||
$writer = WriterEntityFactory::createWriter(Type::ODS);
|
||||
$writer->setDefaultRowStyle($defaultStyle);
|
||||
|
||||
$writer->openToFile($resourcePath);
|
||||
|
||||
Reference in new issue
Block a user