You are here

public function LingotekProfileFormTest::testDeletingProfile in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  2. 4.0.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  3. 3.0.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  4. 3.1.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  5. 3.2.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  6. 3.3.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  7. 3.4.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  8. 3.5.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  9. 3.7.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()
  10. 3.8.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testDeletingProfile()

Test deleting profile.

File

tests/src/Functional/Form/LingotekProfileFormTest.php, line 252

Class

LingotekProfileFormTest
Tests the Lingotek profile form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

public function testDeletingProfile() {

  /** @var \Drupal\lingotek\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 \Drupal\lingotek\LingotekProfileInterface $profile */
  $profile = LingotekProfile::load($profile_id);
  $this
    ->assertNull($profile);
}