Merge branch 'master' of github.com:box/spout into add-phpstan

 Conflicts:
	.travis.yml
	CONTRIBUTING.md
	composer.json
	src/Spout/Common/Entity/Cell.php
	tests/Spout/Writer/ODS/WriterTest.php
This commit is contained in:
Antoine Lamirault committed 2021-09-18 18:14:45 +02:00
commit 540667870a
49 files changed
+529 -152

No files matched your search

@@ -14,7 +14,7 @@ class StyleManagerTest extends TestCase
/**
* @return StyleManager
*/
private function getStyleManager()
private function getStyleManager() : StyleManager
{
$style = (new StyleBuilder())->build();
$styleRegistry = new StyleRegistry($style);
@@ -22,31 +22,37 @@ class StyleManagerTest extends TestCase
return new StyleManager($styleRegistry);
}
/**
* @return void
*/
public function testApplyExtraStylesIfNeededShouldApplyWrapTextIfCellContainsNewLine()
public function testApplyExtraStylesIfNeededShouldApplyWrapTextIfCellContainsNewLine() : void
{
$style = (new StyleBuilder())->build();
$this->assertFalse($style->shouldWrapText());
$styleManager = $this->getStyleManager();
$updatedStyle = $styleManager->applyExtraStylesIfNeeded(new Cell("multi\nlines", $style));
$possiblyUpdatedStyle = $styleManager->applyExtraStylesIfNeeded(new Cell("multi\nlines", $style));
$this->assertTrue($updatedStyle->shouldWrapText());
$this->assertTrue($possiblyUpdatedStyle->isUpdated());
$this->assertTrue($possiblyUpdatedStyle->getStyle()->shouldWrapText());
}
/**
* @return void
*/
public function testApplyExtraStylesIfNeededShouldDoNothingIfWrapTextAlreadyApplied()
public function testApplyExtraStylesIfNeededShouldReturnNullIfWrapTextNotNeeded() : void
{
$style = (new StyleBuilder())->build();
$this->assertFalse($style->shouldWrapText());
$styleManager = $this->getStyleManager();
$possiblyUpdatedStyle = $styleManager->applyExtraStylesIfNeeded(new Cell('oneline', $style));
$this->assertFalse($possiblyUpdatedStyle->isUpdated());
}
public function testApplyExtraStylesIfNeededShouldReturnNullIfWrapTextAlreadyApplied() : void
{
$style = (new StyleBuilder())->setShouldWrapText()->build();
$this->assertTrue($style->shouldWrapText());
$styleManager = $this->getStyleManager();
$updatedStyle = $styleManager->applyExtraStylesIfNeeded(new Cell("multi\nlines", $style));
$possiblyUpdatedStyle = $styleManager->applyExtraStylesIfNeeded(new Cell("multi\nlines", $style));
$this->assertTrue($updatedStyle->shouldWrapText());
$this->assertFalse($possiblyUpdatedStyle->isUpdated());
}
}
@@ -18,7 +18,7 @@ class StyleMergerTest extends TestCase
/**
* @return void
*/
public function setUp()
public function setUp() : void
{
$this->styleMerger = new StyleMerger();
}
@@ -20,7 +20,7 @@ class StyleRegistryTest extends TestCase
/**
* @return void
*/
public function setUp()
public function setUp() : void
{
$this->defaultStyle = (new StyleBuilder())->build();
$this->styleRegistry = new StyleRegistry($this->defaultStyle);