diff --git a/tests/Spout/Common/Manager/OptionsManagerTest.php b/tests/Spout/Common/Manager/OptionsManagerTest.php index 8700547..e2f0c5c 100644 --- a/tests/Spout/Common/Manager/OptionsManagerTest.php +++ b/tests/Spout/Common/Manager/OptionsManagerTest.php @@ -9,12 +9,38 @@ use PHPUnit\Framework\TestCase; */ class OptionsManagerTest extends TestCase { + /** + * @var OptionsManagerAbstract + */ + protected $optionsManager; + + protected function setUp() + { + $this->optionsManager = new class() extends OptionsManagerAbstract { + protected function getSupportedOptions() + { + return [ + 'foo', + 'bar', + 'baz', + ]; + } + + protected function setDefaultOptions() + { + $this->setOption('foo', 'foo-val'); + $this->setOption('bar', false); + } + }; + parent::setUp(); + } + /** * @return void */ public function testOptionsManagerShouldReturnDefaultOptionsIfNothingSet() { - $optionsManager = new FakeOptionsManager(); + $optionsManager = $this->optionsManager; $this->assertEquals('foo-val', $optionsManager->getOption('foo')); $this->assertFalse($optionsManager->getOption('bar')); } @@ -24,7 +50,7 @@ class OptionsManagerTest extends TestCase */ public function testOptionsManagerShouldReturnUpdatedOptionValue() { - $optionsManager = new FakeOptionsManager(); + $optionsManager = $this->optionsManager; $optionsManager->setOption('foo', 'new-val'); $this->assertEquals('new-val', $optionsManager->getOption('foo')); } @@ -34,7 +60,7 @@ class OptionsManagerTest extends TestCase */ public function testOptionsManagerShouldReturnNullIfNoDefaultValueSet() { - $optionsManager = new FakeOptionsManager(); + $optionsManager = $this->optionsManager; $this->assertNull($optionsManager->getOption('baz')); } @@ -43,27 +69,8 @@ class OptionsManagerTest extends TestCase */ public function testOptionsManagerShouldReturnNullIfNoOptionNotSupported() { - $optionsManager = new FakeOptionsManager(); + $optionsManager = $this->optionsManager; $optionsManager->setOption('not-supported', 'something'); $this->assertNull($optionsManager->getOption('not-supported')); } } - -// TODO: Convert this to anonymous class when PHP < 7 support is dropped -class FakeOptionsManager extends OptionsManagerAbstract -{ - protected function getSupportedOptions() - { - return [ - 'foo', - 'bar', - 'baz', - ]; - } - - protected function setDefaultOptions() - { - $this->setOption('foo', 'foo-val'); - $this->setOption('bar', false); - } -} diff --git a/tests/Spout/Writer/ODS/WriterTest.php b/tests/Spout/Writer/ODS/WriterTest.php index fb307b6..e67ad4b 100644 --- a/tests/Spout/Writer/ODS/WriterTest.php +++ b/tests/Spout/Writer/ODS/WriterTest.php @@ -10,7 +10,6 @@ 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\Helper\ZipHelper; use Box\Spout\Writer\Exception\WriterAlreadyOpenedException; use Box\Spout\Writer\Exception\WriterNotOpenedException; use Box\Spout\Writer\RowCreationHelper; @@ -465,15 +464,6 @@ class WriterTest extends TestCase */ public function testGeneratedFileShouldHaveTheCorrectMimeType() { - // Only PHP7+ gives the correct mime type since it requires adding - // uncompressed files to the final archive (which support was added in PHP7) - if (!ZipHelper::canChooseCompressionMethod()) { - $this->markTestSkipped( - 'The PHP version used does not support setting the compression method of archived files, - resulting in the mime type to be detected incorrectly.' - ); - } - $fileName = 'test_mime_type.ods'; $resourcePath = $this->getGeneratedResourcePath($fileName); $dataRow = ['foo'];