diff --git a/core/modules/filter/src/Tests/FilterTextFieldWidgetTest.php b/core/modules/filter/src/Tests/FilterTextFieldWidgetTest.php new file mode 100644 index 0000000..d9f9394 --- /dev/null +++ b/core/modules/filter/src/Tests/FilterTextFieldWidgetTest.php @@ -0,0 +1,96 @@ +container->get('theme_handler')->install(array('seven')); + $this->container->get('config.factory') + ->get('system.theme') + ->set('default', 'seven') + ->set('admin', 'seven') + ->save(); + + // Set up the filter formats used by this test. + /* @var \Drupal\filter\FilterFormatInterface $basic_html_format */ + $basic_html_format = FilterFormat::create([ + 'format' => 'basic_html', + 'name' => 'Basic HTML', + 'filters' => [ + 'filter_html' => [ + 'status' => 1, + 'settings' => [ + 'allowed_html' => '


', + ], + ], + ], + ]); + $basic_html_format->save(); + /* @var \Drupal\filter\FilterFormatInterface $basic_html_format */ + $full_html_format = FilterFormat::create([ + 'format' => 'full_html', + 'name' => 'Full HTML', + 'filters' => [] + ]); + $full_html_format->save(); + $this->adminUser = $this->drupalCreateUser([ + 'administer filters', + 'administer user fields', + $basic_html_format->getPermissionName(), + $full_html_format->getPermissionName(), + ]); + + $this->drupalLogin($this->adminUser); + } + + /** + * Tests the text widget on the user form. + */ + public function testUserTextFieldWidget() { + // Add field. + $this->drupalGet('admin/config/people/accounts/fields'); + $this->drupalPostForm(NULL, [ + 'fields[_add_new_field][label]' => 'baloney', + 'fields[_add_new_field][field_name]' => 'baloney', + 'fields[_add_new_field][type]' => 'text', + ], t('Save')); + $this->drupalPostForm(NULL, [], t('Save field settings')); + $this->drupalPostForm(NULL, [], t('Save settings')); + $this->drupalGet('user/' . $this->adminUser->id() . '/edit'); + $this->assertFieldByName('field_baloney[0][value]'); + } + +} diff --git a/core/modules/filter/src/Tests/TextFormatElementFormTest.php b/core/modules/filter/src/Tests/TextFormatElementFormTest.php index aceab6e..4e399e4 100644 --- a/core/modules/filter/src/Tests/TextFormatElementFormTest.php +++ b/core/modules/filter/src/Tests/TextFormatElementFormTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\system\Tests\TextFormatElementFormTest. + * Contains \Drupal\filter\Tests\TextFormatElementFormTest. */ namespace Drupal\filter\Tests;