You are here

protected function ScannerAdminTest::setUp in Search and Replace Scanner 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ScannerAdminTest.php, line 19

Class

ScannerAdminTest
Tests the default admin settings functionality.

Namespace

Drupal\Tests\scanner\Functional

Code

protected function setUp() {

  // Make sure to complete the normal setup steps first.
  parent::setUp();

  // Create a test content types.
  $this
    ->createContentTypeNode('Title test', 'Body test', 'scanner_test_node_type', 'Scanner test node type');

  // Node content type that will be ignored.
  $this
    ->createContentTypeNode('Ignored title', 'Ignored body', 'scanner_test_ignored_node_type', 'Scanner test ignored node type');

  // Create test Paragraphs content and its fields.
  $paragraphs_type_id = 'scanner_test_paragraph_type';
  $this
    ->addParagraphsType($paragraphs_type_id);
  $this
    ->addFieldtoParagraphType($paragraphs_type_id, 'field_string', 'string');
  $this
    ->addFieldtoParagraphType($paragraphs_type_id, 'field_text', 'text');
  $this
    ->addFieldtoParagraphType($paragraphs_type_id, 'field_text_long', 'text_long');
  $this
    ->addFieldtoParagraphType($paragraphs_type_id, 'field_text_with_summary', 'text_with_summary');

  // Add an unsupported field.
  $this
    ->addFieldtoParagraphType($paragraphs_type_id, 'field_boolean', 'boolean');

  // Add a Paragraphs field to the node content type.
  $this
    ->addParagraphsField('scanner_test_node_type', 'scanner_paragraphs_field', 'node');

  // Create user with the appropriate admin role.
  $user = $this
    ->createUser([
    'administer scanner settings',
  ]);
  $this
    ->drupalLogin($user);
}