While looking for https://www.drupal.org/project/content_sync/issues/3523475 i found that we do not have tests to run, so we can not see if the update to drupal 11 breaks anything.
So i propose we add this to 4.0.x.
Latter when we make changes we can add more tests(for example, export and import content using the web interface), but for now it is best some than none.
Key Actions Performed:
2. Creation of Test Structure: Created the tests/src/Kernel directory within the content_sync module.
3. Kernel Test Development (ContentSyncKernelTest.php):
* testExportImportNode: Verifies that a node can be exported to YAML, deleted, and then imported correctly while maintaining its UUID and values.
* testUpdateNode: Ensures that importing a modified YAML updates an existing node.
* testTaxonomyTerm: Validates the synchronization flow for taxonomy terms.
* testUser: Validates user synchronization, including the handling of user roles.
4. Schema Bug Fix: Identified and fixed missing schema definitions for the module's configuration (content_sync.AdminSettings) by creating the config/schema/content_sync.schema.yml
file. This was necessary because Drupal tests strictly validate configuration schemas.
5. Database Schema Installation: Configured the test setUp method to install all required tables and configurations, including the module's custom tables such as cs_db_snapshot and
cs_logs.
How to Run the Tests:
To run the newly created tests, use the following command from the project root:
1 export SIMPLETEST_DB=sqlite://localhost/tmp/test.sqlite
2 vendor/bin/phpunit -c web/core web/modules/contrib/content_sync/tests/src/Kernel/ContentSyncKernelTest.php
| Comment | File | Size | Author |
|---|---|---|---|
| content_sync_tests_and_schema.patch | 7.39 KB | yukare |
Comments