oliverdavies.uk/content/node.a4efc095-f78d-45ae-854d-fc52c8afa41b.yml

82 lines
2.2 KiB
YAML

uuid:
- value: a4efc095-f78d-45ae-854d-fc52c8afa41b
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:08+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: 'Docblocks or attributes?'
created:
- value: '2024-08-15T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:08+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2024/08/15/docblocks-or-attributes
langcode: en
body:
- value: |
<p>As Drupal 11 uses PHPUnit 10, we can now use the <code>#[Test]</code> attribute instead of the <code>/** @test */</code> annotation for our test methods.</p>
<p>For example:</p>
<pre><code class="php">// Before.
/** @test */
public function it_returns_the_endpoint()
// After.
#[Test]
public function it_returns_the_endpoint()
</code></pre>
<p><a href="/daily/2024/04/04/php-attributes--coming-soon-to-a-drupal-version-near-you">Annotations have started to be replaced</a> in parts of Drupal since 10.2, so it's nice to be able to do it with tests, too.</p>
<p>Which do you prefer?</p>
format: full_html
processed: |
<p>As Drupal 11 uses PHPUnit 10, we can now use the <code>#[Test]</code> attribute instead of the <code>/** @test */</code> annotation for our test methods.</p>
<p>For example:</p>
<pre><code class="php">// Before.
/** @test */
public function it_returns_the_endpoint()
// After.
#[Test]
public function it_returns_the_endpoint()
</code></pre>
<p><a href="/daily/2024/04/04/php-attributes--coming-soon-to-a-drupal-version-near-you">Annotations have started to be replaced</a> in parts of Drupal since 10.2, so it's nice to be able to do it with tests, too.</p>
<p>Which do you prefer?</p>
summary: null
field_daily_email_cta: { }