/**
  * @magentoDataIsolation enabled
  * @magentoDataFixture mediaImportImageFixture
  *
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testSaveMediaImage()
 {
     $this->markTestSkipped('Test must be unskiped after implementation MAGETWO-47449');
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\Filesystem');
     $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
     $source = $this->objectManager->create('\\Magento\\ImportExport\\Model\\Import\\Source\\Csv', ['file' => __DIR__ . '/_files/import_media.csv', 'directory' => $directory]);
     $this->_model->setParameters(['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product', 'import_images_file_dir' => 'pub/media/import']);
     $appParams = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication()->getInitParams()[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS];
     $uploader = $this->_model->getUploader();
     $destDir = $directory->getRelativePath($appParams[DirectoryList::MEDIA][DirectoryList::PATH] . '/catalog/product');
     $tmpDir = $directory->getRelativePath($appParams[DirectoryList::MEDIA][DirectoryList::PATH] . '/import');
     $directory->create($destDir);
     $this->assertTrue($uploader->setDestDir($destDir));
     $this->assertTrue($uploader->setTmpDir($tmpDir));
     $errors = $this->_model->setSource($source)->validateData();
     $this->assertTrue($errors->getErrorsCount() == 0);
     $this->_model->importData();
     $resource = $objectManager->get('Magento\\Catalog\\Model\\ResourceModel\\Product');
     $productId = $resource->getIdBySku('simple_new');
     $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product');
     $product->load($productId);
     $this->assertEquals('/m/a/magento_image.jpg', $product->getData('swatch_image'));
     $gallery = $product->getMediaGalleryImages();
     $this->assertInstanceOf('Magento\\Framework\\Data\\Collection', $gallery);
     $items = $gallery->getItems();
     $this->assertCount(1, $items);
     $item = array_pop($items);
     $this->assertInstanceOf('Magento\\Framework\\DataObject', $item);
     $this->assertEquals('/m/a/magento_image.jpg', $item->getFile());
     $this->assertEquals('Image Label', $item->getLabel());
 }