Exemple #1
0
 /**
  * Different cases to cover all code parts in AbstractEntity::getBehavior()
  *
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @return array
  */
 public function dataProviderForTestGetBehaviorWithRowData()
 {
     return ["add/update behavior and row with delete in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => [AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "delete behavior and row with delete in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => [AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "custom behavior and row with delete in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "add/update behavior and row with update in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => [AbstractEntity::COLUMN_ACTION => 'update'], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "delete behavior and row with update in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => [AbstractEntity::COLUMN_ACTION => 'update'], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "custom behavior and row with update in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => 'update'], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "add/update behavior and row with bogus string in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => [AbstractEntity::COLUMN_ACTION => microtime(true)], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "delete behavior and row with bogus string in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => [AbstractEntity::COLUMN_ACTION => microtime(true)], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "custom behavior and row with bogus string in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => microtime(true)], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "add/update behavior and row with null in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => [AbstractEntity::COLUMN_ACTION => null], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "delete behavior and row with null in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => [AbstractEntity::COLUMN_ACTION => null], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "custom behavior and row with null in action column" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => null], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "add/update behavior and empty row" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => null, '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "delete behavior and empty row" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => null, '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "custom behavior and empty row" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => null, '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM], "add/update behavior and row is empty array" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => [], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE], "delete behavior and empty row is empty array" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => [], '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE], "custom behavior and empty row is empty array" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [], '$expectedBehavior' => AbstractEntity::getDefaultBehavior()], "custom behavior and row with delete in action column and empty available behaviors" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE], '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => []], "custom behavior and row with update in action column and empty available behaviors" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => 'update'], '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => []], "custom behavior and row with bogus string in action column and empty available behaviors" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => microtime(true)], '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => []], "custom behavior and row with null in action column and empty available behaviors" => ['$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => [AbstractEntity::COLUMN_ACTION => null], '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => []]];
 }