Ejemplo n.º 1
0
 /**
  * @param atoum\annotations\extractor $extractor
  *
  * @return $this|void
  */
 protected function setClassAnnotations(atoum\annotations\extractor $extractor)
 {
     parent::setClassAnnotations($extractor);
     $test = $this;
     $extractor->setHandler('resetKernel', function ($value) use($test) {
         $test->enableKernelReset(atoum\annotations\extractor::toBoolean($value));
     })->setHandler('noResetKernel', function () use($test) {
         $test->enableKernelReset(false);
     });
 }
Ejemplo n.º 2
0
 protected function setMethodAnnotations(annotations\extractor $extractor, &$methodName)
 {
     $test = $this;
     $extractor->resetHandlers()->setHandler('ignore', function ($value) use($test, &$methodName) {
         $test->ignoreMethod($methodName, annotations\extractor::toBoolean($value));
     })->setHandler('tags', function ($value) use($test, &$methodName) {
         $test->setMethodTags($methodName, annotations\extractor::toArray($value));
     })->setHandler('dataProvider', function ($value) use($test, &$methodName) {
         $test->setDataProvider($methodName, $value === true ? null : $value);
     })->setHandler('engine', function ($value) use($test, &$methodName) {
         $test->setMethodEngine($methodName, $value);
     })->setHandler('isVoid', function ($value) use($test, &$methodName) {
         $test->setMethodVoid($methodName);
     })->setHandler('isNotVoid', function ($value) use($test, &$methodName) {
         $test->setMethodNotVoid($methodName);
     })->setHandler('php', function ($value) use($test, &$methodName) {
         $value = annotations\extractor::toArray($value);
         if (isset($value[0]) === true) {
             $operator = null;
             if (isset($value[1]) === false) {
                 $version = $value[0];
             } else {
                 $version = $value[1];
                 switch ($value[0]) {
                     case '<':
                     case '<=':
                     case '=':
                     case '==':
                     case '>=':
                     case '>':
                         $operator = $value[0];
                 }
             }
             $test->addMethodPhpVersion($methodName, $version, $operator);
         }
     })->setHandler('extensions', function ($value) use($test, &$methodName) {
         foreach (annotations\extractor::toArray($value) as $mandatoryExtension) {
             $test->addMandatoryMethodExtension($methodName, $mandatoryExtension);
         }
     });
     return $this;
 }
Ejemplo n.º 3
0
 public function testToArray()
 {
     $this->array(annotations\extractor::toArray(''))->isEqualTo(array(''))->array(annotations\extractor::toArray($value = uniqid()))->isEqualTo(array($value))->array(annotations\extractor::toArray(($value = uniqid()) . ' ' . ($otherValue = uniqid())))->isEqualTo(array($value, $otherValue));
 }
Ejemplo n.º 4
0
 protected function setMethodAnnotations(annotations\extractor $extractor, &$methodName)
 {
     $test = $this;
     $extractor->resetHandlers()->setHandler('ignore', function ($value) use($test, &$methodName) {
         $test->ignoreMethod($methodName, annotations\extractor::toBoolean($value));
     })->setHandler('tags', function ($value) use($test, &$methodName) {
         $test->setMethodTags($methodName, annotations\extractor::toArray($value));
     })->setHandler('dataProvider', function ($value) use($test, &$methodName) {
         $test->setDataProvider($methodName, $value);
     })->setHandler('engine', function ($value) use($test, &$methodName) {
         $test->setMethodEngine($methodName, $value);
     })->setHandler('isVoid', function ($value) use($test, &$methodName) {
         $test->setMethodVoid($methodName);
     })->setHandler('isNotVoid', function ($value) use($test, &$methodName) {
         $test->setMethodNotVoid($methodName);
     });
     return $this;
 }
Ejemplo n.º 5
0
 protected function setMethodAnnotations(annotations\extractor $extractor, &$methodName)
 {
     parent::setMethodAnnotations($extractor, $methodName);
     $test = $this;
     $tagHandler = function ($value) use($test, &$methodName) {
         $test->setMethodTags($methodName, annotations\extractor::toArray($value));
     };
     $extractor->setHandler('author', $tagHandler)->setHandler('expectedException', function ($value) use($test, &$methodName) {
         if ($value) {
             $test->addUnsupportedMethod($methodName, '@expectedException is not supported.');
         }
     })->setHandler('group', $tagHandler)->setHandler('large', function () use($tagHandler) {
         $tagHandler('large');
     })->setHandler('medium', function () use($tagHandler) {
         $tagHandler('medium');
     })->setHandler('runInSeparateProcess', function () use($test, &$methodName) {
         $test->setMethodEngine($methodName, 'isolate');
     })->setHandler('small', function () use($tagHandler) {
         $tagHandler('small');
     });
     return $this;
 }