You are here

function ProfileCrudTest::testProfileCreation in Linkit 8.4

Creates profile.

File

src/Tests/ProfileCrudTest.php, line 62
Contains \Drupal\linkit\Tests\ProfileCreationTest.

Class

ProfileCrudTest
Tests creating, loading and deleting profiles.

Namespace

Drupal\linkit\Tests

Code

function testProfileCreation() {
  $this
    ->drupalGet(Url::fromRoute('entity.linkit_profile.add_form'));
  $this
    ->drupalGet('admin/config/content/linkit/add');
  $this
    ->assertResponse(200);

  // Create a profile.
  $edit = [];
  $edit['label'] = Unicode::strtolower($this
    ->randomMachineName());
  $edit['id'] = Unicode::strtolower($this
    ->randomMachineName());
  $edit['description'] = $this
    ->randomMachineName(16);
  $this
    ->drupalPostForm(NULL, $edit, t('Save and manage matchers'));
  $this
    ->assertRaw(t('Created new profile %label.', [
    '%label' => $edit['label'],
  ]));
  $this
    ->drupalGet(Url::fromRoute('entity.linkit_profile.collection'));
  $this
    ->assertText($edit['label'], 'Profile exists in the profile collection.');
}