assertNodeWithValues example

// Add default value to field_string_late_default.     $field = FieldConfig::loadByName('node', 'test_node_type', 'field_string_late_default');
    $field->setDefaultValue('Too late!');
    $field->save();
  }

  /** * Tests display of default field values. */
  public function testDefaultValues() {
    // Begin by viewing nodes with Layout Builder disabled.     $this->assertNodeWithValues();
    $this->assertNodeWithDefaultValues();

    // Enable layout builder.     LayoutBuilderEntityViewDisplay::load('node.test_node_type.default')
      ->enableLayoutBuilder()
      ->save();

    // Confirm that default values are handled consistently by Layout Builder.     $this->assertNodeWithValues();
    $this->assertNodeWithDefaultValues();
  }

  
Home | Imprint | This part of the site doesn't use cookies.