public function ParagraphsTypesTest::testCreateParagraphType

Same name in this branch
  1. 8.x-1.x paragraphs_collection/tests/src/Functional/ParagraphsTypesTest.php \Drupal\Tests\paragraphs_collection\Functional\ParagraphsTypesTest::testCreateParagraphType()
  2. 8.x-1.x paragraphs/tests/src/Functional/WidgetStable/ParagraphsTypesTest.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsTypesTest::testCreateParagraphType()

Tests creating paragraph type.

File

paragraphs/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.');
}