protected function GridStackFormatterTest::setUp in GridStack 8.2
Same name and namespace in other branches
- 8 tests/src/Kernel/GridStackFormatterTest.php \Drupal\Tests\gridstack\Kernel\GridStackFormatterTest::setUp()
File
- tests/
src/ Kernel/ GridStackFormatterTest.php, line 40
Class
- GridStackFormatterTest
- Tests the GridStack field rendering using the image field type.
Namespace
Drupal\Tests\gridstack\KernelCode
protected function setUp() {
parent::setUp();
$this
->installConfig(static::$modules);
$this
->installEntitySchema('gridstack');
$this->testFieldName = 'field_image_multiple';
$this->testEmptyName = 'field_image_multiple_empty';
$this->testPluginId = 'gridstack_image';
$this->maxItems = 7;
$this->maxParagraphs = 2;
$this->gridstackAdmin = $this->container
->get('gridstack.admin');
$this->gridstackManager = $this->container
->get('gridstack.manager');
$this->gridstackFormatter = $this->container
->get('gridstack.formatter');
$data['fields'] = [
'field_video' => 'text',
'field_image' => 'image',
'field_image_multiple_empty' => 'image',
];
// Create contents.
$bundle = $this->bundle;
$this
->setUpContentTypeTest($bundle, $data);
$settings = [
'optionset' => 'frontend',
] + $this
->getFormatterSettings();
$data['settings'] = $settings;
$this->display = $this
->setUpFormatterDisplay($bundle, $data);
$data['plugin_id'] = $this->testPluginId;
$this->displayEmpty = $this
->setUpFormatterDisplay($bundle, $data);
$this->formatterInstance = $this
->getFormatterInstance();
$this->skins = $this->gridstackManager
->skinManager()
->getSkins();
$this
->setUpContentWithItems($bundle);
$this
->setUpRealImage();
// Enable Boostrap support.
$this->gridstackManager
->getConfigFactory()
->getEditable('gridstack.settings')
->set('framework', 'bootstrap')
->save();
}