You are here

public function ParagraphsTypesTest::testCreateParagraphType in Paragraphs 8

Tests creating paragraph type.

File

tests/src/Functional/WidgetStable/ParagraphsTypesTest.php, line 80

Class

ParagraphsTypesTest
Tests paragraphs types.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetStable

Code

public function testCreateParagraphType() {
  $this
    ->loginAsAdmin();

  // Add a paragraph type.
  $this
    ->drupalGet('/admin/structure/paragraphs_type/add');

  // Create a paragraph type with label and id more than 32 characters.
  $edit = [
    'label' => 'Test',
    'id' => 'test_name_with_more_than_32_characters',
  ];
  $this
    ->submitForm($edit, 'Save and manage fields');
  $this
    ->assertSession()
    ->pageTextContains('Machine-readable name cannot be longer than 32 characters but is currently 38 characters long.');
  $edit['id'] = 'new_test_id';
  $this
    ->submitForm($edit, 'Save and manage fields');
  $this
    ->assertSession()
    ->pageTextContains('Saved the Test Paragraphs type.');
}