public function testValidManagerWhenInvalidMethod() { $methods = $this->interfaceManager->getMethods(); $methods->add(new MethodGetterInterfaceManager($this->interfaceManager->getClassManager())); // broken method $this->interfaceManager->setMethods($methods); $errors = $this->getValidator()->validate($this->interfaceManager); $this->assertEquals(1, $errors->count()); }
/** * @param InterfaceManager $item * @param ReflectionClass $reflectionClass * @return InterfaceManager */ protected function resolveInterfaceContent(InterfaceManager $item, ReflectionClass $reflectionClass) { $item->setMethods($this->resolveMethodsToRender($item, $reflectionClass)); return $item; }
/** * Generate methods for interface * * @param InterfaceManager $interface * @return ArrayCollection */ protected function generateAndFillInterfaceMethods(InterfaceManager $interface) { $methodsForInterface = new ArrayCollection(); $classManager = $interface->getClassManager(); foreach ($classManager->getProperties() as $property) { if ($property->isTypeBoolean()) { $methodsForInterface->add((new MethodGetterBooleanInterfaceManager($classManager))->setProperty($property)); } $methodSetterInterfaceManager = new MethodSetterInterfaceManager($classManager); $methodSetterInterfaceManager->setProperty($property); $methodGetterInterfaceManager = new MethodGetterInterfaceManager($classManager); $methodGetterInterfaceManager->setProperty($property); $methodsForInterface->add($methodSetterInterfaceManager); $methodsForInterface->add($methodGetterInterfaceManager); } $interface->setMethods($methodsForInterface); return $interface; }