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:
::testDiscovery()::testGetReferencedPluginClass()(which@dependson the first one)::testRenderComponentLive()(which@dependson the first one)
Proposed resolution
- Add a 4th mandatory test method:
/** * @depends testDiscovery */ public function testSettings(array $component_ids): void;to
ComponentSourceTestBase - Remove
ComponentTest::testComponentCreation()
User interface changes
None.
Issue fork experience_builder-3518838
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
Comment #2
wim leersComment #3
wim leersComment #6
isholgueras commentedComment #7
penyaskitoI'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
Comment #8
isholgueras commentedComment #9
wim leers@isholgueras expanded the scope to also cover #3518833: [PP-2] Update JsComponentTest to subclass ComponentSourceTestBase for consistent test coverage.
Comment #10
wim leersComment #11
wim leers