It's all in the title.

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

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review
mably’s picture

Summary

Significantly improved test coverage for both domain_path and domain_path_pathauto modules by adding comprehensive kernel tests and removing redundant purely-programmatic functional tests that are now covered at the kernel level.

New kernel tests — domain_path (8 files, 20 test methods)

  • DomainPathAliasManagerTest — alias lookups by path/alias/domain, fallback to global alias, domain-specific alias priority, cache invalidation
  • DomainPathConfigTest — domain_path field created/not created based on entity_types config
  • DomainPathDomainDeleteTest — domain deletion removes associated aliases, preserves other domains and global aliases
  • DomainPathMultilingualTest — alias and path lookups respect language codes
  • DomainPathPostSaveTest — create, update, delete, and preserve-unchanged alias behaviors on entity save
  • DomainPathKernelTestBase — added $langcode parameter to createPathAlias() for multilingual test support

New kernel tests — domain_path_pathauto (6 files, 16 test methods)

  • DomainPathautoFieldAlterTest — verifies field type and list class are swapped to pathauto-aware versions via hook_field_info_alter
  • DomainPathautoPostSaveTest — pathauto CREATE generates aliases, SKIP uses manual alias, SKIP with empty alias deletes it
  • DomainPathautoStateDomainDeleteTest — domain deletion cleans up per-domain pathauto state in key_value, preserves other domains
  • DomainPathautoStateTest — per-domain state storage, defaults to CREATE, persists across saves, cleaned on entity delete
  • DomainPathautoUniquifierTest — same-title uniquification across domains, partial conflict (only affected domain gets suffix), isReserved() per domain, no-conflict produces no suffix
  • DomainPathautoKernelTestBase — base class with database-backed keyvalue override and createPathAlias() trait conflict resolution

Removed redundant functional tests (4 files)

  • DomainAliasUniquifierTest (domain_path_pathauto) — purely programmatic, fully covered by kernel DomainPathautoUniquifierTest
  • PathautoNodeProgrammaticNoAccessTest (domain_path_pathauto) — purely programmatic, covered by kernel DomainPathautoPostSaveTest
  • PathautoNodeProgrammaticTest (domain_path_pathauto) — purely programmatic, same behavior as no-access variant
  • DomainPathFallbackTest (domain_path) — purely programmatic, fully covered by kernel DomainPathAliasManagerTest

New functional test

  • DomainPathWidgetDisplayTest — verifies widget labels change based on alias_title config setting (name/hostname/url)

Notable technical details

  • Kernel test base uses $this->container->set('keyvalue', $this->container->get('keyvalue.database')) to persist pathauto state to the database, matching production behavior (pattern from PathautoEntityWithStringIdTest)
  • Domain delete test uses reflection to update the DomainPathPathautoHooks service's keyValueFactory after the container override
  • The createPathAlias() override in DomainPathautoKernelTestBase resolves a PHP trait method conflict where PathautoTestHelperTrait -> PathAliasTestTrait::createPathAlias() (no domain_id param) would shadow the parent class version

Test results

  • 50 kernel tests pass (34 domain_path + 16 domain_path_pathauto), 0 PHPCS violations
mably’s picture

Added FunctionalJavascript tests covering the three #states interactions on the node edit form.

New files

tests/src/FunctionalJavascript/DomainPathStatesTest.php — 3 tests:

  • testDomainAccessCheckboxTogglesPathVisibility — checking/unchecking a domain_access checkbox shows/hides the corresponding domain path alias field via #states['visible'].
  • testAllAffiliatesShowsAllPaths — checking "Send to all affiliates" makes all domain path fields visible regardless of individual domain checkboxes.
  • testDeleteCheckboxDisablesAliasFields — creates a node with aliases on 2 domains, then verifies the "Delete all aliases" checkbox disables/re-enables both alias textfields via #states['disabled'].

modules/domain_path_pathauto/tests/src/FunctionalJavascript/DomainPathautoStatesTest.php — 2 tests:

  • testPathautoCheckboxDisablesAliasField — verifies the per-domain pathauto checkbox independently disables/enables its alias textfield.
  • testPathautoAndDeleteBothDisable — creates a node with pathauto-generated aliases, then tests the combined or logic where either the pathauto or the delete checkbox can independently disable alias fields.

Implementation notes

  • Both test classes extend WebDriverTestBase and use DomainTestTrait.
  • Both disable node_advanced_tab and use_advanced_group config in setUp() to keep domain access and domain path fields in the main form body (not in vertical tabs), making them directly interactable by WebDriver.
  • The pathauto test also uses PathautoTestHelperTrait to create a /content/[node:title] pattern for the page bundle.
  • All 5 tests pass, 0 PHPCS violations.

  • mably committed 94e5346d on 2.x
    task: #3574553 Improve test coverage
    
    By: mably
    
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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