/** * @param StaticMethodDefinition|DefinitionInterface $definition * @param ContextInterface $context */ protected function performTest(DefinitionInterface $definition, ContextInterface $context) { $className = $definition->getClassName(); $methodName = $definition->getMethodName(); if ($definition->getMethodIsPublic()) { call_user_func([$className, $methodName], $context); } else { $method = $definition->getReflectionMethod(); $method->setAccessible(true); $method->invoke(null, $context); } }
/** * @param MethodDefinition|DefinitionInterface $definition * @param ContextInterface $context * @return bool */ protected function performTest(DefinitionInterface $definition, ContextInterface $context) { $instance = $this->objectManager->create($definition->getClassName()); $this->invokeSetup($instance); $methodName = $definition->getMethodName(); if ($definition->getMethodIsPublic()) { $instance->{$methodName}($context); } else { $method = $definition->getReflectionMethod(); $method->setAccessible(true); $method->invoke($instance, $context); } }
/** * @param DefinitionInterface $definition * @return string */ private function getTestDescriptionForDefinition(DefinitionInterface $definition) { if ($definition instanceof AbstractMethodDefinition) { return sprintf('%s%s%s():', $definition->getClassName(), $definition->getMethodIsStatic() ? '::' : '->', $definition->getMethodName()); } elseif ($definition instanceof CodeDefinitionInterface) { $description = $definition->getDescription(); if ($this->getVerbose()) { $description .= ":\nCode:\n" . $this->codeFormatter->formatCode($definition->getPreProcessedCode(), $this->getEnableColoredOutput()) . "\n"; } return $description; } return ''; }
/** * @param DefinitionInterface $definition */ private function prepareTestRunnerForDefinition(DefinitionInterface $definition) { if ($definition->getClassName()) { $this->classLoader->loadClass($definition->getClassName(), $definition->getFile()); } }