You are here

protected function ImsOptionsWidgetsTest::setUp in Improved Multi Select 8

Overrides BrowserTestBase::setUp

File

modules/ims_options_widget/src/Tests/Functional/ImsOptionsWidgetsTest.php, line 52

Class

ImsOptionsWidgetsTest
Tests the IMS Options widgets.

Namespace

Drupal\ims_options_widget\Tests\Functional

Code

protected function setUp() {
  parent::setUp();

  // Field storage with cardinality 2.
  $this->card2 = FieldStorageConfig::create([
    'field_name' => 'card_2',
    'entity_type' => 'entity_test',
    'type' => 'list_integer',
    'cardinality' => 2,
    'settings' => [
      'allowed_values' => [
        // Make sure that 0 works as an option.
        0 => 'Zero',
        1 => 'One',
        // Make sure that option text is properly sanitized.
        2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
      ],
    ],
  ]);
  $this->card2
    ->save();

  // Create a web user.
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'view test entity',
    'administer entity_test content',
  ]));
}