class FieldUiIntegrationTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media_library/tests/src/FunctionalJavascript/FieldUiIntegrationTest.php \Drupal\Tests\media_library\FunctionalJavascript\FieldUiIntegrationTest
- 9 core/modules/media_library/tests/src/FunctionalJavascript/FieldUiIntegrationTest.php \Drupal\Tests\media_library\FunctionalJavascript\FieldUiIntegrationTest
Tests field UI integration for media library widget.
@group media_library
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase
- class \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase
- class \Drupal\Tests\media_library\FunctionalJavascript\FieldUiIntegrationTest
- class \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase
Expanded class hierarchy of FieldUiIntegrationTest
File
- core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ FieldUiIntegrationTest.php, line 10
Namespace
Drupal\Tests\media_library\FunctionalJavascriptView source
class FieldUiIntegrationTest extends MediaLibraryTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'field_ui',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Create a user who can add media fields.
$user = $this
->drupalCreateUser([
'access administration pages',
'administer node fields',
'administer node form display',
]);
$this
->drupalLogin($user);
$this
->drupalCreateContentType([
'type' => 'article',
]);
}
/**
* Tests field UI integration for media library widget.
*/
public function testFieldUiIntegration() {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
$user = $this
->drupalCreateUser([
'access administration pages',
'administer node fields',
'administer node form display',
]);
$this
->drupalLogin($user);
$this
->drupalGet('/admin/structure/types/manage/article/fields/add-field');
$page
->selectFieldOption('new_storage_type', 'field_ui:entity_reference:media');
$this
->assertNotNull($assert_session
->waitForField('label'));
$page
->fillField('label', 'Shatner');
$this
->waitForText('field_shatner');
$page
->pressButton('Save and continue');
$page
->pressButton('Save field settings');
$assert_session
->pageTextNotContains('Undefined index: target_bundles');
$this
->waitForFieldExists('Type One')
->check();
$this
->assertElementExistsAfterWait('css', '[name="settings[handler_settings][target_bundles][type_one]"][checked="checked"]');
$page
->checkField('settings[handler_settings][target_bundles][type_two]');
$this
->assertElementExistsAfterWait('css', '[name="settings[handler_settings][target_bundles][type_two]"][checked="checked"]');
$page
->checkField('settings[handler_settings][target_bundles][type_three]');
$this
->assertElementExistsAfterWait('css', '[name="settings[handler_settings][target_bundles][type_three]"][checked="checked"]');
$page
->pressButton('Save settings');
$assert_session
->pageTextContains('Saved Shatner configuration.');
}
}