mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	In between commit Exception refactoring
This commit is contained in:
		@@ -1,19 +1,19 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace tests\Unit\Domain\TemplateManagement;
 | 
			
		||||
namespace tests\Unit\Domain\AccessDataManagement;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\TestCase;
 | 
			
		||||
use Infinito\Exception\NoValidChoiceException;
 | 
			
		||||
use Infinito\Exception\NotSetException;
 | 
			
		||||
use Infinito\DBAL\Types\ActionType;
 | 
			
		||||
use Infinito\Exception\AllreadySetException;
 | 
			
		||||
use Infinito\Exception\NotCorrectInstanceException;
 | 
			
		||||
use Infinito\Domain\DataAccessManagement\ActionsViewsDAOServiceInterface;
 | 
			
		||||
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOService;
 | 
			
		||||
use Infinito\Domain\DataAccessManagement\ActionsViewsDAOService;
 | 
			
		||||
use Infinito\Entity\EntityInterface;
 | 
			
		||||
use Infinito\Logic\Result\ResultInterface;
 | 
			
		||||
use Infinito\Domain\FormManagement\RequestedActionFormBuilderServiceInterface;
 | 
			
		||||
use Infinito\Exception\Type\InvalidChoiceTypeException;
 | 
			
		||||
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
 | 
			
		||||
use Infinito\Exception\Collection\NotSetElementException;
 | 
			
		||||
use Infinito\Exception\Collection\ContainsElementException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
@@ -49,13 +49,13 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testNotValidChoiceSetException(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(NoValidChoiceException::class);
 | 
			
		||||
        $this->expectException(InvalidChoiceTypeException::class);
 | 
			
		||||
        $this->actionsResultsDAO->setData('1231232N', ' ');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testNotCorrectInstanceSetException(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(NotCorrectInstanceException::class);
 | 
			
		||||
        $this->expectException(NotCorrectInstanceCoreException::class);
 | 
			
		||||
        $data = new class() {
 | 
			
		||||
        };
 | 
			
		||||
        $this->actionsResultsDAO->setData(ActionType::READ, $data);
 | 
			
		||||
@@ -63,13 +63,13 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testNotValidChoiceGetException(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(NoValidChoiceException::class);
 | 
			
		||||
        $this->expectException(InvalidChoiceTypeException::class);
 | 
			
		||||
        $this->actionsViewsDAO->getData('1231232N');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testNotSetGetException(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(NotSetException::class);
 | 
			
		||||
        $this->expectException(NotSetElementException::class);
 | 
			
		||||
        $this->actionsViewsDAO->getData(ActionType::READ);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -115,7 +115,7 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
 | 
			
		||||
//             $viewDataInterface = $this->getActionTypeViewDataMock($actionType);
 | 
			
		||||
//             $this->assertInstanceOf($viewDataInterface, $this->actionsViewsDAO->getData($actionType));
 | 
			
		||||
        }
 | 
			
		||||
        $this->expectException(AllreadySetException::class);
 | 
			
		||||
        $this->expectException(ContainsElementException::class);
 | 
			
		||||
        $this->assertNull($this->actionsResultsDAO->setData($actionType, $resultData));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,6 @@ namespace tests\Integration\Domain\ParameterManagement;
 | 
			
		||||
 | 
			
		||||
use Infinito\Domain\ParameterManagement\ParameterFactory;
 | 
			
		||||
use Infinito\Domain\ParameterManagement\ValidGetParametersService;
 | 
			
		||||
use Infinito\Exception\NotDefinedException;
 | 
			
		||||
use Infinito\Exception\UnvalidParameterException;
 | 
			
		||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
use Symfony\Component\HttpFoundation\RequestStack;
 | 
			
		||||
@@ -13,6 +11,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
 | 
			
		||||
use Infinito\Domain\ParameterManagement\ValidGetParameterServiceInterface;
 | 
			
		||||
use Infinito\Domain\ParameterManagement\Parameter\VersionParameter;
 | 
			
		||||
use Infinito\Domain\ParameterManagement\ParameterFactoryInterface;
 | 
			
		||||
use Infinito\Exception\Validation\GetParameterInvalidException;
 | 
			
		||||
use Infinito\Exception\Collection\NotSetElementException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
@@ -66,22 +66,22 @@ class ValidGetParameterServiceTest extends KernelTestCase
 | 
			
		||||
 | 
			
		||||
    public function testVersionWrongType(): void
 | 
			
		||||
    {
 | 
			
		||||
        $key = VersionParameter::getKey();
 | 
			
		||||
        $this->currentRequest->query->set($key, 'adasdas');
 | 
			
		||||
        $this->expectException(UnvalidParameterException::class);
 | 
			
		||||
        $this->validGetParameterService->getParameter($key);
 | 
			
		||||
        $versionKey = VersionParameter::getKey();
 | 
			
		||||
        $this->currentRequest->query->set($versionKey, 'adasdas');
 | 
			
		||||
        $this->expectException(GetParameterInvalidException::class);
 | 
			
		||||
        $this->validGetParameterService->getParameter($versionKey);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testConstructor(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(NotDefinedException::class);
 | 
			
		||||
        $this->currentRequest->query->set('asdwgwe', 'adasa');
 | 
			
		||||
        $this->expectException(GetParameterInvalidException::class);
 | 
			
		||||
        new ValidGetParametersService($this->requestStack, $this->parameterFactory, $this->validator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testSetParameterException(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(NotDefinedException::class);
 | 
			
		||||
        $this->expectException(NotSetElementException::class);
 | 
			
		||||
        $this->validGetParameterService->getParameter(VersionParameter::getKey());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user