Skip to content

Commit

Permalink
TASK: Throw InvalidArgumentException as \Throwable is not caught …
Browse files Browse the repository at this point in the history
…in tests

> Type error: Neos\ContentRepository\Core\Tests\Behavior\Fixtures\PostalAddress::__construct(): Argument #1 ($streetAddress) must be of type string, null given
  • Loading branch information
mhsdesign committed Oct 21, 2024
1 parent 728b8bc commit b235af6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ Feature: Create node aggregate with node
| nodeAggregateId | "nody-mc-nodeface" |
| nodeTypeName | "Neos.ContentRepository.Testing:NodeWithInvalidDefaultValue" |
| parentNodeAggregateId | "lady-eleonode-rootford" |
Then the last command should have thrown an exception of type "CallErrorException"
Then the last command should have thrown an exception of type "InvalidArgumentException"
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ private function __construct(
public static function fromArray(array $array): self
{
return new self(
$array['streetAddress'],
$array['postalCode'],
$array['addressLocality'],
$array['addressCountry']
$array['streetAddress'] ?? throw new \InvalidArgumentException('streetAddress is not set.'),
$array['postalCode'] ?? throw new \InvalidArgumentException('postalCode is not set.'),
$array['addressLocality'] ?? throw new \InvalidArgumentException('addressLocality is not set.'),
$array['addressCountry'] ?? throw new \InvalidArgumentException('addressCountry is not set.')
);
}

Expand Down

0 comments on commit b235af6

Please sign in to comment.