|
13 | 13 |
|
14 | 14 | use Magento\ImportExport\Model\Import\AbstractEntity;
|
15 | 15 |
|
16 |
| -class EntityAbstractTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractImportTestCase |
| 16 | +class AbstractEntityTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractImportTestCase |
17 | 17 | {
|
18 | 18 | /**
|
19 | 19 | * Abstract import entity model
|
@@ -402,6 +402,36 @@ public function testIsAttributeValid(array $data)
|
402 | 402 | $this->assertEquals(1, $this->_model->getErrorAggregator()->getErrorsCount(), 'Wrong count of errors');
|
403 | 403 | }
|
404 | 404 |
|
| 405 | + /** |
| 406 | + * Test for method isAttributeValid() for multiselect attribute with custom separator. |
| 407 | + * |
| 408 | + * @return void |
| 409 | + */ |
| 410 | + public function testMultiSelectIsAttributeValidWithCustomSeparator() |
| 411 | + { |
| 412 | + $data = $this->_getDataSet( |
| 413 | + 'test3', |
| 414 | + 'select', |
| 415 | + '1;3', |
| 416 | + 'custom', |
| 417 | + null, |
| 418 | + [1 => 'test1', 2 => 'test2', 3 => 'test3'] |
| 419 | + ); |
| 420 | + $attributeCode = $data['code']; |
| 421 | + $attributeParams = [ |
| 422 | + 'type' => $data['type'], |
| 423 | + 'options' => isset($data['options']) ? $data['options'] : null, |
| 424 | + 'is_unique' => isset($data['is_unique']) ? $data['is_unique'] : null, |
| 425 | + ]; |
| 426 | + |
| 427 | + $rowData = [$attributeCode => $data['valid_value']]; |
| 428 | + $this->assertTrue($this->_model->isAttributeValid($attributeCode, $attributeParams, $rowData, 0, ';')); |
| 429 | + |
| 430 | + $rowData[$attributeCode] = $data['invalid_value']; |
| 431 | + $this->assertFalse($this->_model->isAttributeValid($attributeCode, $attributeParams, $rowData, 0, ';')); |
| 432 | + $this->assertEquals(1, $this->_model->getErrorAggregator()->getErrorsCount(), 'Wrong count of errors'); |
| 433 | + } |
| 434 | + |
405 | 435 | /**
|
406 | 436 | * Data provide which retrieve data for test attributes
|
407 | 437 | *
|
|
0 commit comments