You are here

public function JwPlayerConfigurationTest::testDelete in JW Player 8

Tests the UI for deletion of a preset.

File

tests/src/Functional/JwPlayerConfigurationTest.php, line 146

Class

JwPlayerConfigurationTest
Tests configuration of a jw player preset and creation of jw player content.

Namespace

Drupal\Tests\jw_player\Functional

Code

public function testDelete() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);

  // Create a preset.
  $this
    ->drupalPostForm('admin/config/media/jw_player/add', [
    'label' => 'Test preset',
    'id' => 'test_preset',
    'settings[width]' => 100,
    'settings[height]' => 100,
  ], t('Save'));
  $this
    ->clickLink(t('Delete'));
  $this
    ->drupalPostForm(NULL, [], t('Delete'));
  $this
    ->assertRaw(t('The @entity-type %label has been deleted.', [
    '@entity-type' => 'jw player preset',
    '%label' => 'Test preset',
  ]));
  $this
    ->assertEqual([], $this
    ->xpath('//td[text()=@label]', [
    '@label' => 'Test preset',
  ]));
}