You are here

protected function BricksTest::setUp in Bricks​ 8

Same name in this branch
  1. 8 tests/src/Functional/BricksTest.php \Drupal\Tests\bricks\Functional\BricksTest::setUp()
  2. 8 tests/src/Kernel/BricksTest.php \Drupal\Tests\bricks\Kernel\BricksTest::setUp()
Same name and namespace in other branches
  1. 2.x tests/src/Functional/BricksTest.php \Drupal\Tests\bricks\Functional\BricksTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/BricksTest.php, line 32

Class

BricksTest
Class BricksTest

Namespace

Drupal\Tests\bricks\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this->rootUser);
  $this->vocabulary = $this
    ->createVocabulary();

  // Place the actions and title block.
  $this
    ->drupalPlaceBlock('page_title_block', [
    'region' => 'content',
    'weight' => -5,
  ]);
  $this
    ->drupalPlaceBlock('local_tasks_block', [
    'region' => 'content',
    'weight' => -10,
  ]);
  $this
    ->drupalPlaceBlock('local_actions_block', [
    'region' => 'content',
    'weight' => -12,
  ]);

  // Create an article content type that we will use for testing.
  $type = \Drupal::service('entity_type.manager')
    ->getStorage('node_type')
    ->create([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $type
    ->save();
  $this
    ->drupalGet('admin/structure/types/manage/article/fields');
  $this
    ->clickLink('Add field');
  $edit = [
    'new_storage_type' => 'field_ui:bricks:taxonomy_term',
    'label' => 'Brick field',
    'field_name' => 'brick',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save and continue');
  $edit = [
    'cardinality' => -1,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save field settings');
  $edit = [
    'settings[handler_settings][auto_create]' => TRUE,
    'settings[handler_settings][target_bundles][' . $this->vocabulary
      ->id() . ']' => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save settings');
}