You are here

public function LingotekProfileFormTest::testDeletingProfile in Lingotek Translation 8

Test deleting profile.

File

src/Tests/Form/LingotekProfileFormTest.php, line 132

Class

LingotekProfileFormTest
Tests the Lingotek profile form.

Namespace

Drupal\lingotek\Tests\Form

Code

public function testDeletingProfile() {

  /** @var LingotekProfileInterface $profile */
  $profile = LingotekProfile::create([
    'id' => strtolower($this
      ->randomMachineName()),
    'label' => $this
      ->randomString(),
  ]);
  $profile
    ->save();
  $profile_id = $profile
    ->id();
  $this
    ->drupalGet("/admin/lingotek/settings/profile/{$profile_id}/delete");

  // Confirm the form.
  $this
    ->assertText('This action cannot be undone.');
  $this
    ->drupalPostForm(NULL, [], t('Delete'));

  // Profile was deleted.
  $this
    ->assertRaw(t('The lingotek profile %profile has been deleted.', [
    '%profile' => $profile
      ->label(),
  ]));

  /** @var LingotekProfileInterface $profile */
  $profile = LingotekProfile::load($profile_id);
  $this
    ->assertNull($profile);
}