function ProfileCrudTest::testProfileUpdate in Linkit 8.4
Updates a profile.
File
- src/
Tests/ ProfileCrudTest.php, line 83 - Contains \Drupal\linkit\Tests\ProfileCreationTest.
Class
- ProfileCrudTest
- Tests creating, loading and deleting profiles.
Namespace
Drupal\linkit\TestsCode
function testProfileUpdate() {
$profile = $this
->createProfile();
$this
->drupalGet(Url::fromRoute('entity.linkit_profile.edit_form', [
'linkit_profile' => $profile
->id(),
]));
$this
->assertResponse(200);
$id_field = $this
->xpath('.//input[not(@disabled) and @name="id"]');
$this
->assertTrue(empty($id_field), 'Machine name field is disabled.');
$this
->assertLinkByHref(Url::fromRoute('entity.linkit_profile.edit_form', [
'linkit_profile' => $profile
->id(),
])
->toString());
$this
->assertLinkByHref('admin/config/content/linkit/manage/' . $profile
->id() . '/delete');
$edit = [];
$edit['label'] = $this
->randomMachineName();
$edit['description'] = $this
->randomMachineName(16);
$this
->drupalPostForm(NULL, $edit, t('Update profile'));
$this
->assertRaw(t('Updated profile %label.', [
'%label' => $edit['label'],
]));
$this
->drupalGet(Url::fromRoute('entity.linkit_profile.collection'));
$this
->assertText($edit['label'], 'Updated profile exists in the profile collection.');
}