Example #1
0
 /**
  * Create test case for this function
  *
  * @access public
  * @param  object  extension the function is part of
  * @return object  generated test case
  */
 function createTest(CodeGen_PECL_Extension $extension)
 {
     if (!$this->testCode) {
         return false;
     }
     $test = new CodeGen_PECL_Element_Test();
     $test->setName($this->name);
     $test->setTitle($this->name . "() function");
     if ($this->testDescription) {
         $test->setDescription($this->testDescription);
     }
     if ($this->testIni) {
         $test->addIni($this->testIni);
     }
     $test->setSkipIf("!extension_loaded('" . $extension->getName() . "')");
     if ($this->testSkipIf) {
         $test->addSkipIf($this->testSkipIf);
     }
     $test->setCode($this->testCode);
     if (!empty($this->testResult)) {
         $test->setOutput($this->testResult['result']);
         if (isset($this->testResult['mode'])) {
             $test->setMode($this->testResult['mode']);
         }
     }
     return $test;
 }