public function LingotekProfileFormTest::testDeletingProfileBeingUsedInConfigSettings in Lingotek Translation 8
Test deleting profile being used in content is not deleted.
File
- src/
Tests/ Form/ LingotekProfileFormTest.php, line 208
Class
- LingotekProfileFormTest
- Tests the Lingotek profile form.
Namespace
Drupal\lingotek\Tests\FormCode
public function testDeletingProfileBeingUsedInConfigSettings() {
/** @var LingotekProfileInterface $profile */
$profile = LingotekProfile::create([
'id' => strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
]);
$profile
->save();
$profile_id = $profile
->id();
// Create Article node types.
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$edit = [
'table[node_type][enabled]' => 1,
'table[node_type][profile]' => $profile_id,
];
$this
->drupalPostForm('admin/lingotek/settings', $edit, 'Save', [], [], 'lingoteksettings-tab-configuration-form');
$this
->drupalGet("/admin/lingotek/settings/profile/{$profile_id}/delete");
// Confirm the form.
$this
->assertText(t('This action cannot be undone.'));
$this
->drupalPostForm(NULL, [], t('Delete'));
$this
->assertNoRaw(t('The lingotek profile %profile has been deleted.', [
'%profile' => $profile
->label(),
]));
$this
->assertRaw(t('The Lingotek profile %profile is being used so cannot be deleted.', [
'%profile' => $profile
->label(),
]));
/** @var LingotekProfileInterface $profile */
$profile = LingotekProfile::load($profile_id);
$this
->assertNotNull($profile);
}