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
Bug
introduced
by
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 |