for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the JVal package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JVal\Constraint;
use JVal\Context;
use JVal\Testing\ConstraintTestCase;
class EnumConstraintTest extends ConstraintTestCase
{
public function testNormalizeThrowsIfEnumIsNotArray()
$this->expectConstraintException('InvalidTypeException', '/enum');
$schema = $this->loadSchema('invalid/enum-not-array');
$this->getConstraint()->normalize($schema, new Context(), $this->mockWalker());
}
public function testNormalizeThrowsIfEnumIsEmpty()
$this->expectConstraintException('EmptyArrayException', '/enum');
$schema = $this->loadSchema('invalid/enum-empty');
public function testNormalizeThrowsIfEnumElementsAreNotUnique()
$this->expectConstraintException('NotUniqueException', '/enum');
$schema = $this->loadSchema('invalid/enum-elements-not-unique');
protected function getConstraint()
return new EnumConstraint();
protected function getCaseFileNames()
return ['enum'];