Introduce Managers for readers

Some helper classes were more managers than helpers...
This commit is contained in:
Adrien Loison committed 2017-08-27 03:56:17 +02:00
1 parent 61f2addefa
commit 668c10a30d
19 files changed
+376 -339

No files matched your search

@@ -65,15 +65,16 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
->with(CellValueFormatter::XML_NODE_VALUE)
->will($this->returnValue($nodeListMock));
$styleHelperMock = $this->getMockBuilder('Box\Spout\Reader\XLSX\Helper\StyleHelper')->disableOriginalConstructor()->getMock();
/** @var \Box\Spout\Reader\XLSX\Manager\StyleManager|\PHPUnit_Framework_MockObject_MockObject $styleManagerMock */
$styleManagerMock = $this->getMockBuilder('Box\Spout\Reader\XLSX\Manager\StyleManager')->disableOriginalConstructor()->getMock();
$styleHelperMock
$styleManagerMock
->expects($this->once())
->method('shouldFormatNumericValueAsDate')
->with(123)
->will($this->returnValue(true));
$formatter = new CellValueFormatter(null, $styleHelperMock, false, new Escaper\XLSX());
$formatter = new CellValueFormatter(null, $styleManagerMock, false, new Escaper\XLSX());
$result = $formatter->extractAndFormatNodeValue($nodeMock);
if ($expectedDateAsString === null) {
@@ -120,13 +121,14 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
*/
public function testFormatNumericCellValueWithNumbers($value, $expectedFormattedValue, $expectedType)
{
$styleHelperMock = $this->getMockBuilder('Box\Spout\Reader\XLSX\Helper\StyleHelper')->disableOriginalConstructor()->getMock();
$styleHelperMock
/** @var \Box\Spout\Reader\XLSX\Manager\StyleManager|\PHPUnit_Framework_MockObject_MockObject $styleManagerMock */
$styleManagerMock = $this->getMockBuilder('Box\Spout\Reader\XLSX\Manager\StyleManager')->disableOriginalConstructor()->getMock();
$styleManagerMock
->expects($this->once())
->method('shouldFormatNumericValueAsDate')
->will($this->returnValue(false));
$formatter = new CellValueFormatter(null, $styleHelperMock, false, new Escaper\XLSX());
$formatter = new CellValueFormatter(null, $styleManagerMock, false, new Escaper\XLSX());
$formattedValue = \ReflectionHelper::callMethodOnObject($formatter, 'formatNumericCellValue', $value, 0);
$this->assertEquals($expectedFormattedValue, $formattedValue);
@@ -1,154 +0,0 @@
<?php
namespace Box\Spout\Reader\XLSX\Helper;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\HelperFactory;
use Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\CachingStrategyFactory;
use Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\FileBasedStrategy;
use Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\InMemoryStrategy;
use Box\Spout\TestUsingResource;
/**
* Class SharedStringsHelperTest
*
* @package Box\Spout\Reader\XLSX\Helper
*/
class SharedStringsHelperTest extends \PHPUnit_Framework_TestCase
{
use TestUsingResource;
/** @var SharedStringsHelper */
private $sharedStringsHelper;
/**
* @return void
*/
public function setUp()
{
$this->sharedStringsHelper = null;
}
/**
* @return void
*/
public function tearDown()
{
if ($this->sharedStringsHelper !== null) {
$this->sharedStringsHelper->cleanup();
}
}
/**
* @param string $resourceName
* @return SharedStringsHelper
*/
private function createSharedStringsHelper($resourceName = 'one_sheet_with_shared_strings.xlsx')
{
$resourcePath = $this->getResourcePath($resourceName);
$tempFolder = sys_get_temp_dir();
$cachingStrategyFactory = new CachingStrategyFactory();
$helperFactory = new HelperFactory($cachingStrategyFactory);
$entityFactory = new EntityFactory($helperFactory);
$this->sharedStringsHelper = new SharedStringsHelper($resourcePath, $tempFolder, $entityFactory, $helperFactory, $cachingStrategyFactory);
return $this->sharedStringsHelper;
}
/**
* @expectedException \Box\Spout\Reader\Exception\SharedStringNotFoundException
* @return void
*/
public function testGetStringAtIndexShouldThrowExceptionIfStringNotFound()
{
$sharedStringsHelper = $this->createSharedStringsHelper();
$sharedStringsHelper->extractSharedStrings();
$sharedStringsHelper->getStringAtIndex(PHP_INT_MAX);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldReturnTheCorrectStringIfFound()
{
$sharedStringsHelper = $this->createSharedStringsHelper();
$sharedStringsHelper->extractSharedStrings();
$sharedString = $sharedStringsHelper->getStringAtIndex(0);
$this->assertEquals('s1--A1', $sharedString);
$sharedString = $sharedStringsHelper->getStringAtIndex(24);
$this->assertEquals('s1--E5', $sharedString);
$usedCachingStrategy = \ReflectionHelper::getValueOnObject($sharedStringsHelper, 'cachingStrategy');
$this->assertTrue($usedCachingStrategy instanceof InMemoryStrategy);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldWorkWithMultilineStrings()
{
$sharedStringsHelper = $this->createSharedStringsHelper('one_sheet_with_shared_multiline_strings.xlsx');
$sharedStringsHelper->extractSharedStrings();
$sharedString = $sharedStringsHelper->getStringAtIndex(0);
$this->assertEquals("s1\nA1", $sharedString);
$sharedString = $sharedStringsHelper->getStringAtIndex(24);
$this->assertEquals("s1\nE5", $sharedString);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldWorkWithStringsContainingTextAndHyperlinkInSameCell()
{
$sharedStringsHelper = $this->createSharedStringsHelper('one_sheet_with_shared_strings_containing_text_and_hyperlink_in_same_cell.xlsx');
$sharedStringsHelper->extractSharedStrings();
$sharedString = $sharedStringsHelper->getStringAtIndex(0);
$this->assertEquals('go to https://github.com please', $sharedString);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldNotDoubleDecodeHTMLEntities()
{
$sharedStringsHelper = $this->createSharedStringsHelper('one_sheet_with_pre_encoded_html_entities.xlsx');
$sharedStringsHelper->extractSharedStrings();
$sharedString = $sharedStringsHelper->getStringAtIndex(0);
$this->assertEquals('quote: &#34; - ampersand: &amp;', $sharedString);
}
/**
* @return void
*/
public function testGetStringAtIndexWithFileBasedStrategy()
{
// force the file-based strategy by setting no memory limit
$originalMemoryLimit = ini_get('memory_limit');
ini_set('memory_limit', '-1');
$sharedStringsHelper = $this->createSharedStringsHelper('sheet_with_lots_of_shared_strings.xlsx');
$sharedStringsHelper->extractSharedStrings();
$sharedString = $sharedStringsHelper->getStringAtIndex(0);
$this->assertEquals('str', $sharedString);
$sharedString = $sharedStringsHelper->getStringAtIndex(CachingStrategyFactory::MAX_NUM_STRINGS_PER_TEMP_FILE + 1);
$this->assertEquals('str', $sharedString);
$usedCachingStrategy = \ReflectionHelper::getValueOnObject($sharedStringsHelper, 'cachingStrategy');
$this->assertTrue($usedCachingStrategy instanceof FileBasedStrategy);
ini_set('memory_limit', $originalMemoryLimit);
}
}
@@ -1,12 +1,13 @@
<?php
namespace Box\Spout\Reader\XLSX\Helper\SharedStringsCaching;
namespace Box\Spout\Reader\XLSX\Manager\SharedStringsCaching;
use Box\Spout\Reader\XLSX\Creator\HelperFactory;
/**
* Class CachingStrategyFactoryTest
*
* @package Box\Spout\Reader\XLSX\Helper\SharedStringsCaching
* @package Box\Spout\Reader\XLSX\Manager\SharedStringsCaching
*/
class CachingStrategyFactoryTest extends \PHPUnit_Framework_TestCase
{
@@ -38,7 +39,7 @@ class CachingStrategyFactoryTest extends \PHPUnit_Framework_TestCase
{
/** @var CachingStrategyFactory|\PHPUnit_Framework_MockObject_MockObject $factoryStub */
$factoryStub = $this
->getMockBuilder('\Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\CachingStrategyFactory')
->getMockBuilder('\Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory')
->disableOriginalConstructor()
->setMethods(['getMemoryLimitInKB'])
->getMock();
@@ -49,7 +50,7 @@ class CachingStrategyFactoryTest extends \PHPUnit_Framework_TestCase
$helperFactory = new HelperFactory($factoryStub);
$strategy = $factoryStub->createBestCachingStrategy($sharedStringsUniqueCount, $tempFolder, $helperFactory);
$fullExpectedStrategyClassName = 'Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\\' . $expectedStrategyClassName;
$fullExpectedStrategyClassName = 'Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\\' . $expectedStrategyClassName;
$this->assertEquals($fullExpectedStrategyClassName, get_class($strategy));
$strategy->clearCache();
@@ -86,7 +87,7 @@ class CachingStrategyFactoryTest extends \PHPUnit_Framework_TestCase
{
/** @var CachingStrategyFactory|\PHPUnit_Framework_MockObject_MockObject $factoryStub */
$factoryStub = $this
->getMockBuilder('\Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\CachingStrategyFactory')
->getMockBuilder('\Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory')
->disableOriginalConstructor()
->setMethods(['getMemoryLimitFromIni'])
->getMock();
@@ -0,0 +1,156 @@
<?php
namespace Box\Spout\Reader\XLSX\Manager;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\HelperFactory;
use Box\Spout\Reader\XLSX\Creator\ManagerFactory;
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory;
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\FileBasedStrategy;
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\InMemoryStrategy;
use Box\Spout\TestUsingResource;
/**
* Class SharedStringsManagerTest
*
* @package Box\Spout\Reader\XLSX\Manager
*/
class SharedStringsManagerTest extends \PHPUnit_Framework_TestCase
{
use TestUsingResource;
/** @var SharedStringsManager */
private $sharedStringsManager;
/**
* @return void
*/
public function setUp()
{
$this->sharedStringsManager = null;
}
/**
* @return void
*/
public function tearDown()
{
if ($this->sharedStringsManager !== null) {
$this->sharedStringsManager->cleanup();
}
}
/**
* @param string $resourceName
* @return SharedStringsManager
*/
private function createSharedStringsManager($resourceName = 'one_sheet_with_shared_strings.xlsx')
{
$resourcePath = $this->getResourcePath($resourceName);
$tempFolder = sys_get_temp_dir();
$cachingStrategyFactory = new CachingStrategyFactory();
$helperFactory = new HelperFactory();
$managerFactory = new ManagerFactory($helperFactory, $cachingStrategyFactory);
$entityFactory = new EntityFactory($managerFactory, $helperFactory);
$this->sharedStringsManager = new SharedStringsManager($resourcePath, $tempFolder, $entityFactory, $helperFactory, $cachingStrategyFactory);
return $this->sharedStringsManager;
}
/**
* @expectedException \Box\Spout\Reader\Exception\SharedStringNotFoundException
* @return void
*/
public function testGetStringAtIndexShouldThrowExceptionIfStringNotFound()
{
$sharedStringsManager = $this->createSharedStringsManager();
$sharedStringsManager->extractSharedStrings();
$sharedStringsManager->getStringAtIndex(PHP_INT_MAX);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldReturnTheCorrectStringIfFound()
{
$sharedStringsManager = $this->createSharedStringsManager();
$sharedStringsManager->extractSharedStrings();
$sharedString = $sharedStringsManager->getStringAtIndex(0);
$this->assertEquals('s1--A1', $sharedString);
$sharedString = $sharedStringsManager->getStringAtIndex(24);
$this->assertEquals('s1--E5', $sharedString);
$usedCachingStrategy = \ReflectionHelper::getValueOnObject($sharedStringsManager, 'cachingStrategy');
$this->assertTrue($usedCachingStrategy instanceof InMemoryStrategy);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldWorkWithMultilineStrings()
{
$sharedStringsManager = $this->createSharedStringsManager('one_sheet_with_shared_multiline_strings.xlsx');
$sharedStringsManager->extractSharedStrings();
$sharedString = $sharedStringsManager->getStringAtIndex(0);
$this->assertEquals("s1\nA1", $sharedString);
$sharedString = $sharedStringsManager->getStringAtIndex(24);
$this->assertEquals("s1\nE5", $sharedString);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldWorkWithStringsContainingTextAndHyperlinkInSameCell()
{
$sharedStringsManager = $this->createSharedStringsManager('one_sheet_with_shared_strings_containing_text_and_hyperlink_in_same_cell.xlsx');
$sharedStringsManager->extractSharedStrings();
$sharedString = $sharedStringsManager->getStringAtIndex(0);
$this->assertEquals('go to https://github.com please', $sharedString);
}
/**
* @return void
*/
public function testGetStringAtIndexShouldNotDoubleDecodeHTMLEntities()
{
$sharedStringsManager = $this->createSharedStringsManager('one_sheet_with_pre_encoded_html_entities.xlsx');
$sharedStringsManager->extractSharedStrings();
$sharedString = $sharedStringsManager->getStringAtIndex(0);
$this->assertEquals('quote: &#34; - ampersand: &amp;', $sharedString);
}
/**
* @return void
*/
public function testGetStringAtIndexWithFileBasedStrategy()
{
// force the file-based strategy by setting no memory limit
$originalMemoryLimit = ini_get('memory_limit');
ini_set('memory_limit', '-1');
$sharedStringsManager = $this->createSharedStringsManager('sheet_with_lots_of_shared_strings.xlsx');
$sharedStringsManager->extractSharedStrings();
$sharedString = $sharedStringsManager->getStringAtIndex(0);
$this->assertEquals('str', $sharedString);
$sharedString = $sharedStringsManager->getStringAtIndex(CachingStrategyFactory::MAX_NUM_STRINGS_PER_TEMP_FILE + 1);
$this->assertEquals('str', $sharedString);
$usedCachingStrategy = \ReflectionHelper::getValueOnObject($sharedStringsManager, 'cachingStrategy');
$this->assertTrue($usedCachingStrategy instanceof FileBasedStrategy);
ini_set('memory_limit', $originalMemoryLimit);
}
}
@@ -1,37 +1,41 @@
<?php
namespace Box\Spout\Reader\XLSX\Helper;
namespace Box\Spout\Reader\XLSX\Manager;
use Box\Spout\Reader\XLSX\Creator\EntityFactory;
use Box\Spout\Reader\XLSX\Creator\HelperFactory;
use Box\Spout\Reader\XLSX\Helper\SharedStringsCaching\CachingStrategyFactory;
use Box\Spout\Reader\XLSX\Creator\ManagerFactory;
use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory;
/**
* Class StyleManagerTest
*
* @package Box\Spout\Reader\XLSX\Helper
* @package Box\Spout\Reader\XLSX\Manager
*/
class StyleHelperTest extends \PHPUnit_Framework_TestCase
class StyleManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @param array|void $styleAttributes
* @param array|void $customNumberFormats
* @return StyleHelper
* @return StyleManager
*/
private function getStyleHelperMock($styleAttributes = [], $customNumberFormats = [])
private function getStyleManagerMock($styleAttributes = [], $customNumberFormats = [])
{
$entityFactory = new EntityFactory(new HelperFactory(new CachingStrategyFactory()));
$helperFactory = new HelperFactory();
$managerFactory = new ManagerFactory($helperFactory, new CachingStrategyFactory());
$entityFactory = new EntityFactory($managerFactory, $helperFactory);
/** @var StyleHelper $styleHelper */
$styleHelper = $this->getMockBuilder('\Box\Spout\Reader\XLSX\Helper\StyleHelper')
->setConstructorArgs(['/path/to/file.xlsx', $entityFactory])
->setMethods(['getCustomNumberFormats', 'getStylesAttributes'])
->getMock();
/** @var StyleManager $styleManager */
$styleManager = $this->getMockBuilder('\Box\Spout\Reader\XLSX\Manager\StyleManager')
->setConstructorArgs(['/path/to/file.xlsx', $entityFactory])
->setMethods(['getCustomNumberFormats', 'getStylesAttributes'])
->getMock();
$styleHelper->method('getStylesAttributes')->willReturn($styleAttributes);
$styleHelper->method('getCustomNumberFormats')->willReturn($customNumberFormats);
$styleManager->method('getStylesAttributes')->willReturn($styleAttributes);
$styleManager->method('getCustomNumberFormats')->willReturn($customNumberFormats);
return $styleHelper;
return $styleManager;
}
/**
@@ -39,8 +43,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWithDefaultStyle()
{
$styleHelper = $this->getStyleHelperMock();
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(0);
$styleManager = $this->getStyleManagerMock();
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(0);
$this->assertFalse($shouldFormatAsDate);
}
@@ -49,8 +53,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWhenShouldNotApplyNumberFormat()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => false, 'numFmtId' => 14]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => false, 'numFmtId' => 14]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertFalse($shouldFormatAsDate);
}
@@ -59,8 +63,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWithGeneralFormat()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => true, 'numFmtId' => 0]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => true, 'numFmtId' => 0]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertFalse($shouldFormatAsDate);
}
@@ -69,8 +73,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWithNonDateBuiltinFormat()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => true, 'numFmtId' => 9]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => true, 'numFmtId' => 9]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertFalse($shouldFormatAsDate);
}
@@ -79,8 +83,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWithNoNumFmtId()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => true, 'numFmtId' => null]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => true, 'numFmtId' => null]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertFalse($shouldFormatAsDate);
}
@@ -92,8 +96,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
$builtinNumFmtIdsForDate = [14, 15, 16, 17, 18, 19, 20, 21, 22, 45, 46, 47];
foreach ($builtinNumFmtIdsForDate as $builtinNumFmtIdForDate) {
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => true, 'numFmtId' => $builtinNumFmtIdForDate]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => true, 'numFmtId' => $builtinNumFmtIdForDate]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertTrue($shouldFormatAsDate);
}
@@ -104,8 +108,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWhenApplyNumberFormatNotSetAndUsingBuiltinDateFormat()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => null, 'numFmtId' => 14]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => null, 'numFmtId' => 14]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertTrue($shouldFormatAsDate);
}
@@ -115,8 +119,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWhenApplyNumberFormatNotSetAndUsingBuiltinNonDateFormat()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => null, 'numFmtId' => 9]]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => null, 'numFmtId' => 9]]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertFalse($shouldFormatAsDate);
}
@@ -126,8 +130,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
*/
public function testShouldFormatNumericValueAsDateWhenCustomNumberFormatNotFound()
{
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => true, 'numFmtId' => 165]], [166 => []]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => true, 'numFmtId' => 165]], [166 => []]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertFalse($shouldFormatAsDate);
}
@@ -176,8 +180,8 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
public function testShouldFormatNumericValueAsDateWithCustomDateFormats($numberFormat, $expectedResult)
{
$numFmtId = 165;
$styleHelper = $this->getStyleHelperMock([[], ['applyNumberFormat' => true, 'numFmtId' => $numFmtId]], [$numFmtId => $numberFormat]);
$shouldFormatAsDate = $styleHelper->shouldFormatNumericValueAsDate(1);
$styleManager = $this->getStyleManagerMock([[], ['applyNumberFormat' => true, 'numFmtId' => $numFmtId]], [$numFmtId => $numberFormat]);
$shouldFormatAsDate = $styleManager->shouldFormatNumericValueAsDate(1);
$this->assertEquals($expectedResult, $shouldFormatAsDate);
}