oliverdavies.uk/content/node.ac11bd02-625e-4eef-83f3-6ed1f24485ff.yml

79 lines
3 KiB
YAML

uuid:
- value: ac11bd02-625e-4eef-83f3-6ed1f24485ff
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:38+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: |
When writing a failing test, you're designing your code
created:
- value: '2023-07-16T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:38+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2023/07/16/when-writing-a-failing-test-youre-designing-your-code
langcode: en
body:
- value: |
<p>When doing test-driven development, you start by writing a failing test and then write the code to make it pass.</p>
<p>This is the design phase where you ask questions and decide how you want the code to work.</p>
<ul>
<li>Are you going to use a global function or a method on a class?</li>
<li>Will you create a new class or add a method to an existing class?</li>
<li>What will it be called?</li>
<li>Will you use a named method or make the class invokable like a single-method Controller or Action?</li>
<li>Will it accept any parameters?</li>
<li>If so, what will the parameters be, what will they be named, and will they take any default values?</li>
<li>Will it return a value?</li>
<li>Should it throw an Exception?</li>
</ul>
<p>You might iterate on the design and change it as you write more assertions or tests, but take the opportunity to decide how you want the code to work at this point before you start writing the implementation.</p>
format: full_html
processed: |
<p>When doing test-driven development, you start by writing a failing test and then write the code to make it pass.</p>
<p>This is the design phase where you ask questions and decide how you want the code to work.</p>
<ul>
<li>Are you going to use a global function or a method on a class?</li>
<li>Will you create a new class or add a method to an existing class?</li>
<li>What will it be called?</li>
<li>Will you use a named method or make the class invokable like a single-method Controller or Action?</li>
<li>Will it accept any parameters?</li>
<li>If so, what will the parameters be, what will they be named, and will they take any default values?</li>
<li>Will it return a value?</li>
<li>Should it throw an Exception?</li>
</ul>
<p>You might iterate on the design and change it as you write more assertions or tests, but take the opportunity to decide how you want the code to work at this point before you start writing the implementation.</p>
summary: null
field_daily_email_cta: { }