infinito/application/symfony/tests/Integration/Domain/ParameterManagement/Parameter/ViewParameterIntegrationTest.php
2019-03-29 00:29:03 +01:00

31 lines
1.0 KiB
PHP

<?php
namespace tests\Integration\Domain\ParameterManagement\Parameter;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Infinito\Domain\ParameterManagement\Parameter\ViewParameter;
use Infinito\DBAL\Types\ActionType;
/**
* @author kevinfrantz
*/
class ViewParameterIntegrationTest extends KernelTestCase
{
public function testValidation()
{
self::bootKernel();
$validator = self::$container->get(ValidatorInterface::class);
$viewParameter = new ViewParameter();
foreach (ActionType::getValues() as $value) {
$this->assertNull($viewParameter->setValue($value));
$this->assertEquals($value, $viewParameter->getValue());
$errors = $validator->validate($viewParameter)->count();
$this->assertEquals(0, $errors);
}
$viewParameter->setValue('abc');
$errors = $validator->validate($viewParameter)->count();
$this->assertGreaterThan(0, $errors);
}
}