Skip to content

Commit 65a3b61

Browse files
Add expectAttributeIf test helper
1 parent 2649f9a commit 65a3b61

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

shared/Concerns/ExpectAttributes.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ public function expectAttribute(string $key, mixed $value): self
3030
return $this;
3131
}
3232

33+
public function expectAttributeIf(bool $condition, string $key, mixed $value): self
34+
{
35+
if (! $condition) {
36+
return $this;
37+
}
38+
39+
return $this->expectAttribute($key, $value);
40+
}
41+
3342
public function expectHasAttribute(string $key): self
3443
{
3544
expect($this->attributes())->toHaveKey($key);

0 commit comments

Comments
 (0)