예제 #1
0
 public function testDefineWithInvalid()
 {
     $definition = Arguments::define(PrimitiveTypeConstraint::forType(ScalarTypes::SCALAR_STRING), EitherConstraint::create(MaybeConstraint::forType(PrimitiveTypeConstraint::forType(CompoundTypes::COMPOUND_ARRAY)), PrimitiveTypeConstraint::forType(ScalarTypes::SCALAR_BOOLEAN)));
     $definition->check('wow', true);
     $definition->check('wow', []);
     $definition->check('wow', null);
     $this->setExpectedException(InvalidArgumentException::class);
     $definition->check('wow', 25);
 }
예제 #2
0
 public function testIsUnion()
 {
     $instance = new EitherConstraint(new PrimitiveTypeConstraint(ScalarTypes::SCALAR_STRING), new PrimitiveTypeConstraint(ScalarTypes::SCALAR_FLOAT));
     $this->assertTrue($instance->isUnion());
 }