oliverdavies.uk/content/node.a2b118ea-d319-4808-83f6-94ad79c302f2.yml

88 lines
3.5 KiB
YAML

uuid:
- value: a2b118ea-d319-4808-83f6-94ad79c302f2
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:00+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: "Don't create test.php files"
created:
- value: '2025-02-26T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:00+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2025/02/26/test-files
langcode: en
body:
- value: |
<p>Have you written a file like test.php or scratch.php whilst developing?</p>
<p>Do you have files like this committed to your codebase?</p>
<p>These are often temporary files that are written by a Developer to test the code they're writing.</p>
<p>They could include some test data, load a service or perform an action and then dump the result to the screen so they can verify the code they're writing works as expected.</p>
<p>The same could be done with a test.js file that uses a <code>console.log</code> to output to the console.</p>
<p>The issue is that they are only valid at the time they were written and now the code has been written and been tested, the file is likely out of date and either won't or can't be run again.</p>
<p>A better approach is to write tests using a framework like PHPUnit, Pest or Jest instead and to stop writing temporary test files.</p>
<p>Automated tests contain the same arrange, act and assert steps, but they can be run repeatedly.</p>
<p>They can be run by every other Developer in the team.</p>
<p>They can be run automatically in a CI pipeline.</p>
<p>They can be run for every future commit and push so you know that the functionality still works as it did when it was written.</p>
format: full_html
processed: |
<p>Have you written a file like test.php or scratch.php whilst developing?</p>
<p>Do you have files like this committed to your codebase?</p>
<p>These are often temporary files that are written by a Developer to test the code they're writing.</p>
<p>They could include some test data, load a service or perform an action and then dump the result to the screen so they can verify the code they're writing works as expected.</p>
<p>The same could be done with a test.js file that uses a <code>console.log</code> to output to the console.</p>
<p>The issue is that they are only valid at the time they were written and now the code has been written and been tested, the file is likely out of date and either won't or can't be run again.</p>
<p>A better approach is to write tests using a framework like PHPUnit, Pest or Jest instead and to stop writing temporary test files.</p>
<p>Automated tests contain the same arrange, act and assert steps, but they can be run repeatedly.</p>
<p>They can be run by every other Developer in the team.</p>
<p>They can be run automatically in a CI pipeline.</p>
<p>They can be run for every future commit and push so you know that the functionality still works as it did when it was written.</p>
summary: null
field_daily_email_cta: { }