From 1a5d40eff2b62f2862b793fa4fd6b2e28133bb10 Mon Sep 17 00:00:00 2001 From: Daniel Haven Date: Sun, 15 Sep 2024 22:19:46 -0400 Subject: [PATCH] Update mutation-testing.md This adds a note to use `pest-mutate-ignore` on non-executable code. **Important**: Please verify if GitHub Markdown Alerts get parsed properly in the docs site before merging this in. Related Issue: https://github.com/pestphp/pest/issues/1231 --- mutation-testing.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mutation-testing.md b/mutation-testing.md index edc420e..bf012f9 100644 --- a/mutation-testing.md +++ b/mutation-testing.md @@ -187,6 +187,31 @@ public function rules(): array } ``` +> [!NOTE] +> Lines that aren't considered executable will always be marked as UNCOVERED. + +For such cases, like with model properties, you may apply `@pest-mutate-ignore` in the following way.  + +```php +/** + * @pest-mutate-ignore + */ +protected $guarded = [ + 'id', + 'created_at', + 'updated_at', +]; + +/** + * @pest-mutate-ignore + */ +protected $hidden = [ + 'id', + 'created_at', + 'updated_at', +]; +``` + ### `--id`