Example #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);
     });
 }
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
 public function testToBoolean()
 {
     $this->boolean(annotations\extractor::toBoolean(true))->isTrue()->boolean(annotations\extractor::toBoolean(false))->isFalse()->boolean(annotations\extractor::toBoolean('on'))->isTrue()->boolean(annotations\extractor::toBoolean('On'))->isTrue()->boolean(annotations\extractor::toBoolean('ON'))->isTrue()->boolean(annotations\extractor::toBoolean('oN'))->isTrue()->boolean(annotations\extractor::toBoolean('off'))->isFalse()->boolean(annotations\extractor::toBoolean('Off'))->isFalse()->boolean(annotations\extractor::toBoolean('OFF'))->isFalse();
 }
Example #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;
 }