You are here

protected function VarbaseStyleGuideTest::setUp in Varbase Style Guide 9.0.x

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/VarbaseStyleGuideTest.php, line 59

Class

VarbaseStyleGuideTest
Tests Varbase Style Guide.

Namespace

Drupal\Tests\varbase_styleguide\FunctionalJavascript

Code

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

  // Insall the Claro admin theme.
  $this->container
    ->get('theme_installer')
    ->install([
    'claro',
  ]);

  // Set the Claro theme as the default admin theme.
  $this
    ->config('system.theme')
    ->set('admin', 'claro')
    ->save();
  drupal_flush_all_caches();

  // Given that the root super user was logged in to the site.
  $this
    ->drupalLogin($this->rootUser);

  // Create a content type and activate all.
  $this->testContentType = $this
    ->drupalCreateContentType([
    'type' => 'post',
    'name' => 'Post',
  ]);
  $storage = FieldStorageConfig::create([
    'entity_type' => 'node',
    'field_name' => 'field_image',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'media',
    ],
  ]);
  $storage
    ->save();
  FieldConfig::create([
    'field_storage' => $storage,
    'entity_type' => 'node',
    'bundle' => 'post',
    'label' => 'Main image',
    'settings' => [
      'handler_settings' => [
        'target_bundles' => [
          'image' => 'image',
        ],
      ],
    ],
  ])
    ->save();
  drupal_flush_all_caches();

  // Create a testing node.
  $this
    ->drupalCreateNode([
    'title' => 'Post - Test Content',
    'type' => 'post',
    'body' => [
      [
        'value' => 'Varbase is an enhanced Drupal distribution packed with adaptive
            functionalities and essential modules, that speed up your development,
            and provides you with standardized configurations, making your life easier.

            The essence of Varbase, lies within the basic concept that initiated it;
            DRY (Don’t Repeat Yourself). Varbase handles that for you, relieving you
            from repeating all the modules, features, configurations that are included
            in every Drupal project.',
      ],
    ],
  ]);
}