You are here

public function RangeBothValuesRequiredConstraintValidatorTest::testInvalidValueType in Range 8

@covers ::validate

File

tests/src/Unit/Plugin/Validation/Constraint/RangeBothValuesRequiredConstraintValidatorTest.php, line 87

Class

RangeBothValuesRequiredConstraintValidatorTest
Tests the RangeBothValuesRequiredConstraintValidator validator.

Namespace

Drupal\Tests\range\Unit\Plugin\Validation\Constraint

Code

public function testInvalidValueType() {
  $context = $this
    ->createMock(ExecutionContextInterface::class);
  $constraint = new RangeBothValuesRequiredConstraint();
  $validate = new RangeBothValuesRequiredConstraintValidator();
  $validate
    ->initialize($context);
  $this
    ->expectException(UnexpectedTypeException::class);
  $validate
    ->validate(new \stdClass(), $constraint);
}