Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 5620ff9

Browse files
committed
Allow array values usage on hasAttribute test util
1 parent 726d4a2 commit 5620ff9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Testing/Concerns/HasAttributes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ trait HasAttributes
1717
/**
1818
* Assert that a resource has an attribute with name and value (optional).
1919
*
20-
* @param mixed $name
21-
* @param mixed $value
20+
* @param int|string $name
21+
* @param array<string>|string $value
2222
*
2323
* @return $this
2424
*/
@@ -27,7 +27,7 @@ public function hasAttribute($name, $value = null)
2727
PHPUnit::assertArrayHasKey($name, $this->attributes, sprintf('JSON:API response does not have an attribute named "%s"', $name));
2828

2929
if ($value) {
30-
PHPUnit::assertContains($value, $this->attributes, sprintf('JSON:API response does not have an attribute named "%s" with value "%s"', $name, $value));
30+
PHPUnit::assertContains($value, $this->attributes, sprintf('JSON:API response does not have an attribute named "%s" with value "%s"', $name, json_encode($value)));
3131
}
3232

3333
return $this;

0 commit comments

Comments
 (0)