You are here

public function ProfileAdminTest::testProfileCreation in Linkit 8.5

Creates profile.

File

tests/src/Functional/ProfileAdminTest.php, line 55

Class

ProfileAdminTest
Tests creating, loading and deleting profiles.

Namespace

Drupal\Tests\linkit\Functional

Code

public function testProfileCreation() {
  $this
    ->drupalLogin($this->adminUser);

  // Make sure the profile add page is accessible.
  $this
    ->drupalGet('/admin/config/content/linkit/add');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Create a profile.
  $edit = [];
  $edit['label'] = mb_strtolower($this
    ->randomMachineName());
  $edit['id'] = mb_strtolower($this
    ->randomMachineName());
  $edit['description'] = $this
    ->randomMachineName(16);
  $this
    ->submitForm($edit, 'Save and manage matchers');

  // Make sure that the new profile was saved properly.
  $this
    ->assertSession()
    ->pageTextContains('Created new profile ' . $edit['label']);
  $this
    ->drupalGet('/admin/config/content/linkit');
  $this
    ->assertSession()
    ->pageTextContains($edit['label']);
}