cvs: pear /CodeGen_PECL/PECL/Element Function.php

From: Date: Sun, 31 Jul 2005 17:29:54 +0000
Subject: cvs: pear /CodeGen_PECL/PECL/Element Function.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-33485@lists.php.net to get a copy of this message
hholzgra Sun Jul 31 13:29:54 2005 EDT Modified files: /pear/CodeGen_PECL/PECL/Element Function.php Log: use extension->getConstants instead of direct property access, testcase skipif and ini sections are now configurable http://cvs.php.net/diff.php/pear/CodeGen_PECL/PECL/Element/Function.php?r1=1.3&r2=1.4&ty=u Index: pear/CodeGen_PECL/PECL/Element/Function.php diff -u pear/CodeGen_PECL/PECL/Element/Function.php:1.3 pear/CodeGen_PECL/PECL/Element/Function.php:1.4 --- pear/CodeGen_PECL/PECL/Element/Function.php:1.3 Wed Jul 27 13:35:21 2005 +++ pear/CodeGen_PECL/PECL/Element/Function.php Sun Jul 31 13:29:52 2005 @@ -15,7 +15,7 @@ * @author Hartmut Holzgraefe <hartmut@php.net> * @copyright 2005 Hartmut Holzgraefe * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Function.php,v 1.3 2005/07/27 17:35:21 hholzgra Exp $ + * @version CVS: $Id: Function.php,v 1.4 2005/07/31 17:29:52 hholzgra Exp $ * @link http://pear.php.net/package/CodeGen */ @@ -478,19 +478,20 @@ break; default: // now see if this is a constand defined by this extension - if (isset($extension->constants[$token])) { - $param["default"] = $extension->constants[$token]->value; + $constants = $extension->getConstants(); + if (isset($constants[$token])) { + $param["default"] = $constants[$token]->value; } else { - return PEAR::raiseError("x1 invalid default value '$token' specification for parameter '$param[name]' ($type)"); + return PEAR::raiseError("invalid default value '$token' specification for parameter '$param[name]' ($type)"); } } break; default: - return PEAR::raiseError("x2 invalid default value '$token' specification for parameter '$param[name]' ($type)"); + return PEAR::raiseError("invalid default value '$token' specification for parameter '$param[name]' ($type)"); } break; default: - return PEAR::raiseError("x3 invalid default value '$token' specification for parameter '$param[name]' ($type)"); + return PEAR::raiseError("invalid default value '$token' specification for parameter '$param[name]' ($type)"); } if ($firstOptional && count($params)+1 >= $firstOptional) { @@ -770,6 +771,63 @@ } + /** + * test additional skipif condition + * + * @var string + */ + protected $testSkipIf = ""; + + /** + * testSkipIf setter + * + * @param string code snippet + */ + function setTestSkipIf($code) + { + $this->testSkipIf = $code; + } + + /** + * testSkipIf getter + * + * @return string + */ + function getTestSkipIf() + { + return $this->testSkipIf; + } + + + + /** + * test additional ini condition + * + * @var string + */ + protected $testIni = ""; + + /** + * testIni setter + * + * @param string code snippet + */ + function setTestIni($code) + { + $this->testIni = $code; + } + + /** + * testIni getter + * + * @return string + */ + function getTestIni() + { + return $this->testIni; + } + + @@ -1197,8 +1255,20 @@ $test->setName($this->name); $test->setTitle($this->name."() function"); - $test->setSkipIf("!extension_loaded('".$extension->getName()."')"); + + $test->setIni("extension_dir=../modules"); // TODO be more clever about this? + $test->addIni("extension=".$extension->getName().".so"); // TODO .so is UNIX-only + if ($this->testIni) { + $test->addIni($this->testIni); + } + + $test->setSkipIf("!extension_loaded('".$extension->getName()."')"; + if ($this->testSkipIf) { + $test->addSkipIf($this->testSkipIf); + } + $test->setCode($this->testCode); + $test->setOutput($this->testResult); $test->writeTest($extension); @@ -1216,4 +1286,4 @@ } } -?> \ No newline at end of file +?>

« previous php.pear.cvs (#33485) next »