Implemented test for exception

This commit is contained in:
Kevin Frantz
2019-01-06 15:42:40 +01:00
parent c7c4e1c16e
commit 3ab9cb0e99
3 changed files with 17 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Domain\SourceManagement;
use App\Domain\EntityManagement\EntityMetaInformation;
use App\Entity\Source\AbstractSource;
use App\Exception\NotCorrectInstanceException;
/**
* @author kevinfrantz
@@ -22,7 +23,7 @@ final class SourceMetaInformation extends EntityMetaInformation implements Sourc
public function __construct(\App\Entity\EntityInterface $entity)
{
if (!$entity instanceof AbstractSource) {
throw new \TypeError('Entity has to be an instance of '.AbstractSource::class);
throw new NotCorrectInstanceException('Entity has to be an instance of '.AbstractSource::class);
}
parent::__construct($entity);
}

View File

@@ -0,0 +1,7 @@
<?php
namespace App\Exception;
class NotCorrectInstanceException extends \TypeError
{
}