public function ProfileAdminTest::testProfileUpdate in Linkit 8.5
Updates a profile.
File
- tests/
src/ Functional/ ProfileAdminTest.php, line 78
Class
- ProfileAdminTest
- Tests creating, loading and deleting profiles.
Namespace
Drupal\Tests\linkit\FunctionalCode
public function testProfileUpdate() {
$this
->drupalLogin($this->adminUser);
// Create a profile.
$profile = $this
->createProfile();
// Make sure the profile edit page is accessible.
$this
->drupalGet('/admin/config/content/linkit/manage/' . $profile
->id());
$this
->assertSession()
->statusCodeEquals(200);
// Make sure the machine name field is disabled and that we have certain
// elements presented.
$this
->assertSession()
->elementNotExists('xpath', '//input[not(@disabled) and @name="id"]');
$this
->assertSession()
->buttonExists('Update profile');
$this
->assertSession()
->linkByHrefExists('/admin/config/content/linkit/manage/' . $profile
->id() . '/delete');
// Update the profile.
$edit = [];
$edit['label'] = $this
->randomMachineName();
$edit['description'] = $this
->randomMachineName(16);
$this
->submitForm($edit, 'Update profile');
// Make sure that the profile was updated properly.
$this
->assertSession()
->pageTextContains('Updated profile ' . $edit['label']);
$this
->drupalGet('/admin/config/content/linkit');
$this
->assertSession()
->pageTextContains($edit['label']);
}