Issues (3641)

Plugin/PaymentMethodDataImportPluginTest.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\PaymentDataImport\Communication\Plugin;
9
10
use Codeception\Test\Unit;
11
use Generated\Shared\Transfer\DataImporterConfigurationTransfer;
12
use Generated\Shared\Transfer\DataImporterReaderConfigurationTransfer;
13
use Spryker\Zed\PaymentDataImport\Communication\Plugin\PaymentMethodDataImportPlugin;
14
15
/**
16
 * Auto-generated group annotations
17
 *
18
 * @group SprykerTest
19
 * @group Zed
20
 * @group PaymentDataImport
21
 * @group Communication
22
 * @group Plugin
23
 * @group PaymentMethodDataImportPluginTest
24
 * Add your own group annotations below this line
25
 */
26
class PaymentMethodDataImportPluginTest extends Unit
27
{
28
    /**
29
     * @var int
30
     */
31
    protected const EXPECTED_IMPORT_COUNT = 2;
32
33
    /**
34
     * @var \SprykerTest\Zed\PaymentDataImport\PaymentDataImportCommunicationTester
35
     */
36
    protected $tester;
37
38
    /**
39
     * @return void
40
     */
41
    public function testImportImportsPaymentMethods(): void
42
    {
43
        //Arrange
44
        $this->tester->ensurePaymentMethodTableIsEmpty();
45
        $dataImporterReaderConfigurationTransfer = new DataImporterReaderConfigurationTransfer();
46
        $dataImporterReaderConfigurationTransfer->setFileName(codecept_data_dir() . 'import/payment_method.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

46
        $dataImporterReaderConfigurationTransfer->setFileName(/** @scrutinizer ignore-call */ codecept_data_dir() . 'import/payment_method.csv');
Loading history...
47
48
        $dataImportConfigurationTransfer = new DataImporterConfigurationTransfer();
49
        $dataImportConfigurationTransfer->setReaderConfiguration($dataImporterReaderConfigurationTransfer);
50
51
        $paymentMethodDataImportPlugin = new PaymentMethodDataImportPlugin();
52
53
        //Act
54
        $dataImporterReportTransfer = $paymentMethodDataImportPlugin->import($dataImportConfigurationTransfer);
55
56
        //Assert
57
        $this->assertTrue($dataImporterReportTransfer->getIsSuccess(), 'Data import should finish successfully');
58
59
        $this->assertSame(
60
            static::EXPECTED_IMPORT_COUNT,
61
            $dataImporterReportTransfer->getImportedDataSetCount(),
62
            sprintf(
63
                'Imported number of payment methods is %s expected %s.',
64
                $dataImporterReportTransfer->getImportedDataSetCount(),
65
                static::EXPECTED_IMPORT_COUNT,
66
            ),
67
        );
68
    }
69
}
70