uuid: - value: 9834732b-1b38-471a-b1bb-64471b27a2ee langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T09:00:28+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: | Why I prefer integration tests to unit tests created: - value: '2023-11-14T00:00:00+00:00' changed: - value: '2025-05-11T09:00:28+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2023/11/14/why-i-prefer-integration-tests-to-unit-tests langcode: en body: - value: |
With unit tests, you need to mock everything.
If what you're testing has a dependency, you need to create and use a mock version.
If the mock has its own dependencies, you need to mock those, too.
I've written unit tests with mocks and accidentally only tested the mocks instead of the functionality I intended.
With integration tests, you can use and test the real dependencies.
Whilst they may be slightly slower to run, I prefer the simpler setup, less need for mocks, and knowing the real services work - not just the mocked versions.
format: full_html processed: |With unit tests, you need to mock everything.
If what you're testing has a dependency, you need to create and use a mock version.
If the mock has its own dependencies, you need to mock those, too.
I've written unit tests with mocks and accidentally only tested the mocks instead of the functionality I intended.
With integration tests, you can use and test the real dependencies.
Whilst they may be slightly slower to run, I prefer the simpler setup, less need for mocks, and knowing the real services work - not just the mocked versions.
summary: null field_daily_email_cta: { }