![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-import-export/Test/Unit/Model/Source/Export/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\ImportExport\Test\Unit\Model\Source\Export; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\ImportExport\Model\Export\ConfigInterface; use Magento\ImportExport\Model\Source\Export\Format; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class FormatTest extends TestCase { /** * @var ConfigInterface|MockObject */ private $exportConfigMock; /** * @var Format */ private $model; /** * Setup environment for test */ protected function setUp(): void { $this->exportConfigMock = $this->getMockForAbstractClass(ConfigInterface::class); $objectManager = new ObjectManager($this); $this->model = $objectManager->getObject( Format::class, [ 'exportConfig' => $this->exportConfigMock ] ); } /** * Test toOptionArray with data provider * * @param array $fileFormats * @param array $expected * @dataProvider toOptionArrayDataProvider */ public function testToOptionArray($fileFormats, $expected) { $this->exportConfigMock->expects($this->any())->method('getFileFormats')->willReturn($fileFormats); $this->assertEquals($expected, $this->model->toOptionArray()); } /** * Data Provider for test toOptionArray * * @return array */ public function toOptionArrayDataProvider() { return [ 'Empty file format' => [ [], [] ], 'Has file format' => [ [ 'fileFormat1' => [ 'label' => 'File Format 1' ] ], [ [ 'label' => (string)__('File Format 1'), 'value' => 'fileFormat1' ] ] ] ]; } }