Example #1
0
 public function testResetHandlers()
 {
     $this->if($extractor = new annotations\extractor())->then->object($extractor->resetHandlers())->isIdenticalTo($extractor)->array($extractor->getHandlers())->isEmpty()->if($extractor->setHandler(uniqid(), function () {
     }))->then->object($extractor->resetHandlers())->isIdenticalTo($extractor)->array($extractor->getHandlers())->isEmpty();
 }
Example #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;
 }
Example #3
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;
 }