View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7;
use Drupal\field\Entity\FieldStorageConfig;
class FieldTest extends Ubercart7TestBase {
protected static $modules = [
'comment',
'commerce_price',
'commerce_product',
'commerce_store',
'image',
'migrate_plus',
'node',
'path',
'taxonomy',
'text',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('commerce_product');
$this
->executeMigration('d7_field');
}
public function testFields() {
$field_storages = [
'commerce_product.body',
'commerce_product.field_number',
'commerce_product.field_sustainability',
'commerce_product.taxonomy_catalog',
'commerce_product.uc_product_image',
'node.body',
'node.field_image',
'node.field_number',
'node.field_tags',
'taxonomy_term.uc_catalog_image',
];
foreach ($field_storages as $field_storage) {
$storage = FieldStorageConfig::load($field_storage);
$this
->assertInstanceOf(FieldStorageConfig::class, $storage, "{$field_storage} is not an instance of FieldStorageConfig");
}
$storage = FieldStorageConfig::load('node.field_sustainability');
$this
->assertNull($storage);
$storage = FieldStorageConfig::load('node.uc_product_image');
$this
->assertNull($storage);
}
}