protected function ProductAdminTest::setUp in Commerce Core 8.2
Overrides ProductBrowserTestBase::setUp
File
- modules/
product/ tests/ src/ Functional/ ProductAdminTest.php, line 45
Class
- ProductAdminTest
- Create, view, edit, delete, and change products.
Namespace
Drupal\Tests\commerce_product\FunctionalCode
protected function setUp() : void {
parent::setUp();
FieldStorageConfig::create([
'field_name' => 'field_image',
'type' => 'image',
'entity_type' => 'commerce_product_variation',
])
->save();
FieldConfig::create([
'field_name' => 'field_image',
'entity_type' => 'commerce_product_variation',
'bundle' => 'default',
'label' => 'Image',
'settings' => [
'alt_field_required' => FALSE,
],
])
->save();
$form_display = EntityFormDisplay::load('commerce_product_variation.default.default');
$form_display
->setComponent('field_image', [
'type' => 'image_image',
]);
$form_display
->save();
$file_system = \Drupal::service('file_system');
$this->testImage = current($this
->getTestFiles('image'));
$this->testImage->realpath = $file_system
->realpath($this->testImage->uri);
}