Issue #3269502 by danflanagan8, dww: Field and Field UI tests should not rely on Classy

(cherry picked from commit ee5db8334c)
merge-requests/2022/head
catch 2022-03-29 10:19:07 +01:00
parent 02bb7cb218
commit 39865b51bf
4 changed files with 18 additions and 18 deletions

View File

@ -29,7 +29,7 @@ class BooleanFieldTest extends BrowserTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $defaultTheme = 'classy'; protected $defaultTheme = 'stark';
/** /**
* A field to use in this test class. * A field to use in this test class.
@ -122,7 +122,7 @@ class BooleanFieldTest extends BrowserTestBase {
// Verify that boolean value is displayed. // Verify that boolean value is displayed.
$entity = EntityTest::load($id); $entity = EntityTest::load($id);
$this->drupalGet($entity->toUrl()); $this->drupalGet($entity->toUrl());
$this->assertSession()->responseContains('<div class="field__item">' . $on . '</div>'); $this->assertSession()->pageTextContains($on);
// Test with "On" label option. // Test with "On" label option.
$display_repository->getFormDisplay('entity_test', 'entity_test') $display_repository->getFormDisplay('entity_test', 'entity_test')

View File

@ -126,8 +126,8 @@ class DisplayApiTest extends FieldKernelTestBase {
public function testFieldItemListView() { public function testFieldItemListView() {
$items = $this->entity->get($this->fieldName); $items = $this->entity->get($this->fieldName);
\Drupal::service('theme_installer')->install(['classy']); \Drupal::service('theme_installer')->install(['stark']);
$this->config('system.theme')->set('default', 'classy')->save(); $this->config('system.theme')->set('default', 'stark')->save();
// No display settings: check that default display settings are used. // No display settings: check that default display settings are used.
$build = $items->view(); $build = $items->view();

View File

@ -64,9 +64,9 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
// Use Classy theme for testing markup output. // Use Stark theme for testing markup output.
\Drupal::service('theme_installer')->install(['classy']); \Drupal::service('theme_installer')->install(['stark']);
$this->config('system.theme')->set('default', 'classy')->save(); $this->config('system.theme')->set('default', 'stark')->save();
$this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test');
// Grant the 'view test entity' permission. // Grant the 'view test entity' permission.
$this->installConfig(['user']); $this->installConfig(['user']);
@ -201,12 +201,12 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
// Test the first field item. // Test the first field item.
$expected_rendered_name_field_1 = ' $expected_rendered_name_field_1 = '
<div class="field field--name-name field--type-string field--label-hidden field__item">' . $this->referencedEntity->label() . '</div> <div>' . $this->referencedEntity->label() . '</div>
'; ';
$expected_rendered_body_field_1 = ' $expected_rendered_body_field_1 = '
<div class="clearfix text-formatted field field--name-body field--type-text field--label-above"> <div>
<div class="field__label">Body</div> <div>Body</div>
<div class="field__item"><p>Hello, world!</p></div> <div><p>Hello, world!</p></div>
</div> </div>
'; ';
$renderer->renderRoot($build[0]); $renderer->renderRoot($build[0]);
@ -217,12 +217,12 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
// Test the second field item. // Test the second field item.
$expected_rendered_name_field_2 = ' $expected_rendered_name_field_2 = '
<div class="field field--name-name field--type-string field--label-hidden field__item">' . $this->unsavedReferencedEntity->label() . '</div> <div>' . $this->unsavedReferencedEntity->label() . '</div>
'; ';
$expected_rendered_body_field_2 = ' $expected_rendered_body_field_2 = '
<div class="clearfix text-formatted field field--name-body field--type-text field--label-above"> <div>
<div class="field__label">Body</div> <div>Body</div>
<div class="field__item"><p>Hello, unsaved world!</p></div> <div><p>Hello, unsaved world!</p></div>
</div> </div>
'; ';

View File

@ -20,7 +20,7 @@ class EntityDisplayTest extends WebDriverTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $defaultTheme = 'classy'; protected $defaultTheme = 'stark';
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -74,7 +74,7 @@ class EntityDisplayTest extends WebDriverTestBase {
*/ */
public function testEntityView() { public function testEntityView() {
$this->drupalGet('entity_test/1'); $this->drupalGet('entity_test/1');
$this->assertSession()->elementNotExists('css', '.field--name-field-test-text'); $this->assertSession()->pageTextNotContains('The field test text value');
$this->drupalGet('entity_test/structure/entity_test/display'); $this->drupalGet('entity_test/structure/entity_test/display');
$this->assertSession()->elementExists('css', '.region-content-message.region-empty'); $this->assertSession()->elementExists('css', '.region-content-message.region-empty');
@ -91,7 +91,7 @@ class EntityDisplayTest extends WebDriverTestBase {
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected()); $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
$this->drupalGet('entity_test/1'); $this->drupalGet('entity_test/1');
$this->assertSession()->elementExists('css', '.field--name-field-test-text'); $this->assertSession()->pageTextContains('The field test text value');
} }
/** /**