Exemplo n.º 1
0
 public function testCheckWithChained()
 {
     $instance = new EitherConstraint(new PrimitiveTypeConstraint(CompoundTypes::COMPOUND_ARRAY), new EitherConstraint(new ClassTypeConstraint(CoreException::class), new PrimitiveTypeConstraint(ScalarTypes::SCALAR_FLOAT)));
     $this->assertEqualsMatrix([[false, $instance->check(null)], [false, $instance->check('hello world')], [false, $instance->check('hello world' . null)], [false, $instance->check(27645)], [true, $instance->check(276.564)], [false, $instance->check(new stdClass())], [true, $instance->check(new CoreException())], [true, $instance->check(new UnknownTypeException('doge'))], [true, $instance->check(['omg', 'doge', 'yes'])], [true, $instance->check([])]]);
 }