public function JwPlayer7ConfigurationTest::testLicenseConfig in JW Player 8
Tests the jw player license configuration.
File
- tests/
src/ Functional/ JwPlayer7ConfigurationTest.php, line 235
Class
- JwPlayer7ConfigurationTest
- Tests configuration of a jw player 7 preset and creation of jw player content.
Namespace
Drupal\Tests\jw_player\FunctionalCode
public function testLicenseConfig() {
$admin_user = $this
->drupalCreateUser(array(
'administer site configuration',
'administer JW Player presets',
));
$this
->drupalLogin($admin_user);
$edit = [
'jw_player_hosting' => 'self',
'jw_player_key' => $license_key = 'this_is_my_fancy_license_key',
];
$this
->drupalPostForm('admin/config/media/jw_player/settings', $edit, t('Save configuration'));
// Assert the key is saved.
$this
->drupalGet('admin/config/media/jw_player/settings');
$this
->assertFieldByName('jw_player_key', $license_key);
$edit = [
'jw_player_hosting' => 'cloud',
'cloud_player_library_url' => $cloud_url = 'this_is_my_fancy_cloud_url',
];
$this
->drupalPostForm('admin/config/media/jw_player/settings', $edit, t('Save configuration'));
// Assert the cloud url is saved and the license key is cleared.
$this
->drupalGet('admin/config/media/jw_player/settings');
$this
->assertNoFieldByName('jw_player_key', $license_key);
$this
->assertFieldByName('cloud_player_library_url', $cloud_url);
}