/**
  * @dataProvider exportDataDataProvider
  * @param bool $isMany
  * @param array $input
  * @param array $expected
  */
 public function testConvertToExportFormat($isMany, array $input, array $expected)
 {
     $nodeKey = 'test_key';
     $converted = ['key1' => 'val1', 'key2' => 'val2'];
     $rules = ['key' => 'cKey', $nodeKey => 'nKey'];
     $nodeDataConverter = $this->getMockBuilder('Oro\\Bundle\\ImportExportBundle\\Converter\\DataConverterInterface')->setMethods(['convertToImportFormat'])->getMockForAbstractClass();
     $this->dataConverter->expects($this->atLeastOnce())->method('getHeaderConversionRules')->will($this->returnValue($rules));
     $this->dataConverter->expects($this->once())->method('getBackendHeader')->will($this->returnValue(array_values($rules)));
     if ($isMany) {
         $rowsCount = count($input[$rules[$nodeKey]]);
         $nodeDataConverter->expects($this->exactly($rowsCount))->method('convertToExportFormat')->will($this->returnValue($converted));
         for ($i = 0; $i < $rowsCount; $i++) {
             $nodeDataConverter->expects($this->at($i))->method('convertToExportFormat')->with($input[$rules[$nodeKey]][$i]);
         }
     } else {
         $nodeDataConverter->expects($this->once())->method('convertToExportFormat')->with($input[$rules[$nodeKey]])->will($this->returnValue($converted));
     }
     $this->dataConverter->addNodeDataConverter($nodeKey, $nodeDataConverter, $isMany);
     $this->assertEquals($expected, $this->dataConverter->convertToExportFormat($input));
 }
 /**
  * {@inheritdoc}
  */
 public function convertToExportFormat(array $exportedRecord, $skipNullValues = true)
 {
     $exportedRecord = parent::convertToExportFormat($exportedRecord, $skipNullValues);
     // store_id can be 0
     if (isset($exportedRecord['store']['store_id'])) {
         $exportedRecord['store_id'] = $exportedRecord['store']['store_id'];
         unset($exportedRecord['store']);
     }
     // Do not clear confirmCode until its empty
     if (empty($exportedRecord['subscriber_confirm_code'])) {
         unset($exportedRecord['subscriber_confirm_code']);
     }
     return $exportedRecord;
 }
 /**
  * {@inheritdoc}
  */
 public function convertToExportFormat(array $exportedRecord, $skipNullValues = true)
 {
     $exportedRecord = parent::convertToExportFormat($exportedRecord, $skipNullValues);
     if (isset($exportedRecord['store']['store_id'])) {
         $exportedRecord['store_id'] = $exportedRecord['store']['store_id'];
         unset($exportedRecord['store']);
     }
     if (isset($exportedRecord['website']['id'])) {
         $exportedRecord['website_id'] = $exportedRecord['website']['id'];
         unset($exportedRecord['website']);
     }
     if (isset($exportedRecord['group']['customer_group_id'])) {
         $exportedRecord['group_id'] = $exportedRecord['group']['customer_group_id'];
         unset($exportedRecord['group']);
     }
     if (empty($exportedRecord['password'])) {
         unset($exportedRecord['password']);
     }
     if (!empty($exportedRecord['gender'])) {
         $exportedRecord['gender'] = $this->getMagentoGender($exportedRecord['gender']);
     }
     unset($exportedRecord['created_at'], $exportedRecord['updated_at'], $exportedRecord['addresses']);
     return $exportedRecord;
 }