Overview

\Drupal\Tests\experience_builder\Kernel\Config\ComponentTest::testComponentCreation() was first created for SDC only. Then JS components were added to it.

This is partially superseded by ComponentSourceTestBase::testDiscovery(), but that tests only the auto-creation of the Component config entity, not the settings (default_settings for block components, prop_field_definitions for SDC and JS components) of the created Component config entity.

#3501290: Introduce unit test coverage for both ComponentSource plugins (Block + SDC) added ComponentSourceTestBase with only 3 mandatory test methods:

  1. ::testDiscovery()
  2. ::testGetReferencedPluginClass() (which @depends on the first one)
  3. ::testRenderComponentLive() (which @depends on the first one)

Proposed resolution

  1. Add a 4th mandatory test method:
      /**
       * @depends testDiscovery
       */
      public function testSettings(array $component_ids): void;
    

    to ComponentSourceTestBase

  2. Remove ComponentTest::testComponentCreation()

User interface changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wim leers created an issue. See original summary.

wim leers’s picture

Issue tags: +maintainability
wim leers’s picture

Assigned: Unassigned » isholgueras
Issue summary: View changes

isholgueras made their first commit to this issue’s fork.

isholgueras’s picture

Assigned: isholgueras » Unassigned
Status: Active » Needs review
penyaskito’s picture

Assigned: Unassigned » isholgueras
Status: Needs review » Needs work

I'd like to see JsComponentTest to look more like BlockComponentTest and SingleDirectoryComponentTest. Not having a setup() will make easier to test the discovery too, aside of providing consistency in the 3 tests.

We could use some dataProviders here and there and avoid some helper methods in JsComponentTest

isholgueras’s picture

Assigned: isholgueras » Unassigned
Status: Needs work » Needs review
wim leers’s picture

wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.