Issues (3641)

MerchantProductOptionGroupDataImportPluginTest.php (1 issue)

1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerTest\Zed\MerchantProductOptionDataImport\Communication\Plugin;
9
10
use Codeception\Test\Unit;
11
use Generated\Shared\Transfer\DataImporterConfigurationTransfer;
12
use Generated\Shared\Transfer\DataImporterReaderConfigurationTransfer;
13
use Generated\Shared\Transfer\DataImporterReportTransfer;
14
use Spryker\Zed\MerchantProductOptionDataImport\Communication\Plugin\DataImport\MerchantProductOptionGroupDataImportPlugin;
15
use Spryker\Zed\MerchantProductOptionDataImport\MerchantProductOptionDataImportConfig;
16
17
/**
18
 * Auto-generated group annotations
19
 *
20
 * @group SprykerTest
21
 * @group Zed
22
 * @group MerchantProductOptionDataImport
23
 * @group Communication
24
 * @group Plugin
25
 * @group MerchantProductOptionGroupDataImportPluginTest
26
 * Add your own group annotations below this line
27
 */
28
class MerchantProductOptionGroupDataImportPluginTest extends Unit
29
{
30
    /**
31
     * @var \SprykerTest\Zed\MerchantProductOptionDataImport\MerchantProductOptionDataImportCommunicationTester
32
     */
33
    protected $tester;
34
35
    /**
36
     * @return void
37
     */
38
    public function testImportImportsData(): void
39
    {
40
        // Arrange
41
        $this->tester->ensureMerchantProductOptionGroupTableIsEmpty();
42
43
        $dataImporterReaderConfigurationTransfer = new DataImporterReaderConfigurationTransfer();
44
        $dataImporterReaderConfigurationTransfer->setFileName(codecept_data_dir() . 'import/merchant_product_option_group.csv');
0 ignored issues
show
The function codecept_data_dir was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
        $dataImporterReaderConfigurationTransfer->setFileName(/** @scrutinizer ignore-call */ codecept_data_dir() . 'import/merchant_product_option_group.csv');
Loading history...
45
46
        $dataImportConfigurationTransfer = new DataImporterConfigurationTransfer();
47
        $dataImportConfigurationTransfer->setReaderConfiguration($dataImporterReaderConfigurationTransfer);
48
49
        $dataImportPlugin = new MerchantProductOptionGroupDataImportPlugin();
50
51
        // Act
52
        $dataImporterReportTransfer = $dataImportPlugin->import($dataImportConfigurationTransfer);
53
54
        // Assert
55
        $this->assertInstanceOf(DataImporterReportTransfer::class, $dataImporterReportTransfer);
56
        $this->tester->assertMerchantProductOptionGroupTableContainsData();
57
    }
58
59
    /**
60
     * @return void
61
     */
62
    public function testGetImportTypeReturnsTypeOfImporter(): void
63
    {
64
        // Act
65
        $MerchantProductOptionGroupDataImportPlugin = new MerchantProductOptionGroupDataImportPlugin();
66
67
        // Assert
68
        $this->assertSame(
69
            MerchantProductOptionDataImportConfig::IMPORT_TYPE_MERCHANT_PRODUCT_OPTION_GROUP,
70
            $MerchantProductOptionGroupDataImportPlugin->getImportType(),
71
        );
72
    }
73
}
74