function it_is_not_fine_with_concrete_object_and_abstract_methods(Object $object, Method $method)
 {
     $object->getName()->willReturn('ConcreteClass');
     $object->isAbstract()->willReturn(false);
     $object->allMethods()->willReturn(array($method));
     $method->isAbstract()->willReturn(true);
     $method->getName()->willReturn('abstractClass');
     $this->validate($object)->shouldHaveType('Memio\\Validator\\Violation\\SomeViolation');
 }
示例#2
0
 function it_also_validates_methods(CollectionValidator $collectionValidator, MethodValidator $methodValidator, Object $model, Method $method)
 {
     $constants = array();
     $contracts = array();
     $methods = array($method);
     $properties = array();
     $violationCollection1 = new ViolationCollection();
     $violationCollection2 = new ViolationCollection();
     $violationCollection3 = new ViolationCollection();
     $violationCollection4 = new ViolationCollection();
     $violationCollection5 = new ViolationCollection();
     $model->getName()->willReturn('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
     $model->isAbstract()->willReturn(true);
     $model->allConstants()->willReturn($constants);
     $model->allContracts()->willReturn($contracts);
     $model->allMethods()->willReturn($methods);
     $model->allProperties()->willReturn($properties);
     $collectionValidator->validate($constants)->willReturn($violationCollection1);
     $collectionValidator->validate($contracts)->willReturn($violationCollection2);
     $collectionValidator->validate($properties)->willReturn($violationCollection3);
     $collectionValidator->validate($methods)->willReturn($violationCollection4);
     $methodValidator->validate($method)->willReturn($violationCollection5);
     $this->validate($model);
 }