Skip to content

Commit

Permalink
Merge pull request #176 from wjzijderveld/assertion-message
Browse files Browse the repository at this point in the history
Better error message for NamedConstructorAggregateFactory assertion
  • Loading branch information
othillo committed Jun 25, 2015
2 parents 26ab0d8 + 36a7027 commit 911f89f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ public function __construct($staticConstructorMethod = 'instantiateForReconstitu
*/
public function create($aggregateClass, DomainEventStreamInterface $domainEventStream)
{
Assert::true(method_exists($aggregateClass, $this->staticConstructorMethod));

$methodCall = sprintf('%s::%s', $aggregateClass, $this->staticConstructorMethod);

Assert::true(
method_exists($aggregateClass, $this->staticConstructorMethod),
sprintf('NamedConstructorAggregateFactory expected %s to exist', $methodCall)
);

$aggregate = call_user_func($methodCall);

Assert::isInstanceOf($aggregate, $aggregateClass);
Expand Down

0 comments on commit 911f89f

Please sign in to comment.