/**
  * @magentoDataFixture Magento/Bundle/_files/product.php
  */
 public function testPrepareData()
 {
     $collection = $this->objectManager->get('Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection');
     $select = (string) $collection->getSelect();
     $this->model->prepareData($collection, [1, 2, 3, 4]);
     $this->assertEquals($select, (string) $collection->getSelect());
     $result = $this->model->addData([], 3);
     $this->assertArrayHasKey('bundle_price_type', $result);
     $this->assertArrayHasKey('bundle_sku_type', $result);
     $this->assertArrayHasKey('bundle_price_view', $result);
     $this->assertArrayHasKey('bundle_weight_type', $result);
     $this->assertArrayHasKey('bundle_values', $result);
     $this->assertContains('sku=simple,', $result['bundle_values']);
 }
 /**
  * Test addData()
  */
 public function testAddData()
 {
     $preparedData = $this->rowCustomizerMock->prepareData($this->productResourceCollection, [1]);
     $dataRow = ['sku' => 'sku1', 'additional_attributes' => 'attribute=1,sku_type=1,price_type=1,price_view=1,weight_type=1,values=values'];
     $preparedRow = $preparedData->addData($dataRow, 1);
     $expected = ['sku' => 'sku1', 'additional_attributes' => 'attribute=1', 'bundle_price_type' => 'fixed', 'bundle_sku_type' => 'fixed', 'bundle_price_view' => 'As low as', 'bundle_weight_type' => 'fixed', 'bundle_values' => 'name=title,type=1,required=1,sku=1,price=1,default=,default_qty=1,price_type=percent'];
     $this->assertEquals($expected, $preparedRow);
 }
 /**
  * @magentoDataFixture Magento/Bundle/_files/product.php
  */
 public function testPrepareData()
 {
     /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
     $collection = $this->objectManager->get('Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection');
     $select = $collection->getConnection()->select()->from(['p' => $collection->getTable('catalog_product_entity')], ['sku', 'entity_id'])->where('sku IN(?)', ['simple', 'custom-design-simple-product', 'bundle-product']);
     $ids = $collection->getConnection()->fetchPairs($select);
     $select = (string) $collection->getSelect();
     $this->model->prepareData($collection, array_values($ids));
     $this->assertEquals($select, (string) $collection->getSelect());
     $result = $this->model->addData([], $ids['bundle-product']);
     $this->assertArrayHasKey('bundle_price_type', $result);
     $this->assertArrayHasKey('bundle_sku_type', $result);
     $this->assertArrayHasKey('bundle_price_view', $result);
     $this->assertArrayHasKey('bundle_weight_type', $result);
     $this->assertArrayHasKey('bundle_values', $result);
     $this->assertContains('sku=simple,', $result['bundle_values']);
     $this->assertEquals([], $this->model->addData([], $ids['simple']));
 }