mageekguy\atoum\test::getMandatoryMethodExtensions PHP Метод

getMandatoryMethodExtensions() публичный Метод

public getMandatoryMethodExtensions ( $testMethodName = null )
    public function getMandatoryMethodExtensions($testMethodName = null)
    {
        $extensions = array();
        $mandatoryClassExtensions = $this->getMandatoryClassExtensions();
        if ($testMethodName === null) {
            foreach ($this->testMethods as $testMethodName => $annotations) {
                if (isset($annotations['mandatoryExtensions']) === false) {
                    $extensions[$testMethodName] = $mandatoryClassExtensions;
                } else {
                    $extensions[$testMethodName] = array_merge($mandatoryClassExtensions, $annotations['mandatoryExtensions']);
                }
            }
        } else {
            if (isset($this->checkMethod($testMethodName)->testMethods[$testMethodName]['mandatoryExtensions']) === false) {
                $extensions = $mandatoryClassExtensions;
            } else {
                $extensions = array_merge($mandatoryClassExtensions, $this->testMethods[$testMethodName]['mandatoryExtensions']);
            }
        }
        return $extensions;
    }

Usage Example

Пример #1
0
 /**
  * @param test   $test
  * @param string $methodNameToCheck
  * @return bool
  * @throws \RuntimeException
  */
 public function isMethodIgnored(test $test, $methodNameToCheck)
 {
     $contexts = array();
     foreach ($test->getTestMethods() as $methodName) {
         $contexts[$methodName] = new HoaContext();
         $contexts[$methodName]['method'] = $methodName;
         $contexts[$methodName]['class'] = $test->getClass();
         $contexts[$methodName]['namespace'] = $test->getClassNamespace();
         $contexts[$methodName]['testedclass'] = $test->getTestedClassName();
         $contexts[$methodName]['testedclassnamespace'] = $test->getTestedClassNamespace();
     }
     foreach ($test->getMandatoryMethodExtensions() as $methodName => $extensions) {
         $contexts[$methodName]['extensions'] = $extensions;
     }
     foreach ($test->getMethodTags() as $methodName => $tags) {
         $contexts[$methodName]['tags'] = $tags;
     }
     if (!isset($contexts[$methodNameToCheck])) {
         throw new \RuntimeException(sprintf('Method not found : %s', $methodNameToCheck));
     }
     return false === $this->ruler->assert($this->rule, $contexts[$methodNameToCheck]);
 }
test