{ "uuid": [ { "value": "9aeee1e5-7b2c-4ce8-b034-ecd7531edf7c" } ], "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:05+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": "How would you write this test name?" } ], "created": [ { "value": "2024-10-22T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:00:05+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2024\/10\/22\/how-would-you-write-this-test-name", "langcode": "en" } ], "body": [ { "value": "\n
There are multiple ways I've seen people write their test method names.<\/p>\n\n
This is the standard PSR-compliant camel-case method name:<\/p>\n\n
public function testSomethingHappensWhenYouGoToThePage()\n<\/code><\/pre>\n\nSome people find long camel-case names hard to read and prefer to use snake-case names:<\/p>\n\n
public function test_something_happens_when_you_go_to_the_page()\n<\/code><\/pre>\n\nThis still works as the method name still starts with the word test<\/code>, but you'd need to add some overrides to phpcs for it not to complain about using snake-case words.<\/p>\n\nAnother option is to remove the test<\/code> prefix and use an annotation:<\/p>\n\n\/** @test *\/\npublic function something_happens_when_you_go_to_the_page()\n<\/code><\/pre>\n\nAnd in newer PHPUnit versions, you can also use an attribute:<\/p>\n\n
#[Test]\npublic function something_happens_when_you_go_to_the_page()\n<\/code><\/pre>\n\nWhilst this makes the method name shorter, you need to add an additional line before each test method for the annotation or attribute.<\/p>\n\n
Each has pros and cons, and people have their own preferences.<\/p>\n\n
Which do you do?<\/p>\n\n ",
"format": "full_html",
"processed": "\n
There are multiple ways I've seen people write their test method names.<\/p>\n\n
This is the standard PSR-compliant camel-case method name:<\/p>\n\n
public function testSomethingHappensWhenYouGoToThePage()\n<\/code><\/pre>\n\nSome people find long camel-case names hard to read and prefer to use snake-case names:<\/p>\n\n
public function test_something_happens_when_you_go_to_the_page()\n<\/code><\/pre>\n\nThis still works as the method name still starts with the word test<\/code>, but you'd need to add some overrides to phpcs for it not to complain about using snake-case words.<\/p>\n\nAnother option is to remove the test<\/code> prefix and use an annotation:<\/p>\n\n\/** @test *\/\npublic function something_happens_when_you_go_to_the_page()\n<\/code><\/pre>\n\nAnd in newer PHPUnit versions, you can also use an attribute:<\/p>\n\n
#[Test]\npublic function something_happens_when_you_go_to_the_page()\n<\/code><\/pre>\n\nWhilst this makes the method name shorter, you need to add an additional line before each test method for the annotation or attribute.<\/p>\n\n
Each has pros and cons, and people have their own preferences.<\/p>\n\n
Which do you do?<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "1970-01-01T00:33:45+00:00",
"guid": null,
"hash": "74d7fe2b760e2005106513cfa1b4cae7",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}