Commit ee5db833 authored by catch's avatar catch
Browse files

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

parent 579208e4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class BooleanFieldTest extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * A field to use in this test class.
@@ -122,7 +122,7 @@ public function testBooleanField() {
    // Verify that boolean value is displayed.
    $entity = EntityTest::load($id);
    $this->drupalGet($entity->toUrl());
    $this->assertSession()->responseContains('<div class="field__item">' . $on . '</div>');
    $this->assertSession()->pageTextContains($on);

    // Test with "On" label option.
    $display_repository->getFormDisplay('entity_test', 'entity_test')
+2 −2
Original line number Diff line number Diff line
@@ -126,8 +126,8 @@ protected function setUp(): void {
  public function testFieldItemListView() {
    $items = $this->entity->get($this->fieldName);

    \Drupal::service('theme_installer')->install(['classy']);
    $this->config('system.theme')->set('default', 'classy')->save();
    \Drupal::service('theme_installer')->install(['stark']);
    $this->config('system.theme')->set('default', 'stark')->save();

    // No display settings: check that default display settings are used.
    $build = $items->view();
+11 −11
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
  protected function setUp(): void {
    parent::setUp();

    // Use Classy theme for testing markup output.
    \Drupal::service('theme_installer')->install(['classy']);
    $this->config('system.theme')->set('default', 'classy')->save();
    // Use Stark theme for testing markup output.
    \Drupal::service('theme_installer')->install(['stark']);
    $this->config('system.theme')->set('default', 'stark')->save();
    $this->installEntitySchema('entity_test');
    // Grant the 'view test entity' permission.
    $this->installConfig(['user']);
@@ -201,12 +201,12 @@ public function testEntityFormatter() {

    // Test the first field item.
    $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 = '
  <div class="clearfix text-formatted field field--name-body field--type-text field--label-above">
    <div class="field__label">Body</div>
              <div class="field__item"><p>Hello, world!</p></div>
  <div>
    <div>Body</div>
              <div><p>Hello, world!</p></div>
          </div>
';
    $renderer->renderRoot($build[0]);
@@ -217,12 +217,12 @@ public function testEntityFormatter() {

    // Test the second field item.
    $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 = '
  <div class="clearfix text-formatted field field--name-body field--type-text field--label-above">
    <div class="field__label">Body</div>
              <div class="field__item"><p>Hello, unsaved world!</p></div>
  <div>
    <div>Body</div>
              <div><p>Hello, unsaved world!</p></div>
          </div>
';

+3 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ class EntityDisplayTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
@@ -74,7 +74,7 @@ public function testEntityForm() {
   */
  public function testEntityView() {
    $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->assertSession()->elementExists('css', '.region-content-message.region-empty');
@@ -91,7 +91,7 @@ public function testEntityView() {
    $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());

    $this->drupalGet('entity_test/1');
    $this->assertSession()->elementExists('css', '.field--name-field-test-text');
    $this->assertSession()->pageTextContains('The field test text value');
  }

  /**