/** * Retrieves the aggregate root * * @return EventSourcedAggregateRoot * * @throws RegisterAggregateException When the aggregate root is invalid */ protected function getAggregateRoot() { if ($this->aggregateRoot === null) { throw RegisterAggregateException::create('Aggregate root is not registered'); } return $this->aggregateRoot; }
public function test_that_create_returns_exception_instance() { $exception = RegisterAggregateException::create('Aggregate registration error'); $this->assertInstanceOf('Novuso\\Common\\Domain\\EventSourcing\\Exception\\RegisterAggregateException', $exception); }