本文整理汇总了PHP中PHPUnit_Util_Class::getMethodParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Class::getMethodParameters方法的具体用法?PHP PHPUnit_Util_Class::getMethodParameters怎么用?PHP PHPUnit_Util_Class::getMethodParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Class
的用法示例。
在下文中一共展示了PHPUnit_Util_Class::getMethodParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
#!/usr/bin/env php
<?php
require dirname(__DIR__) . '/PHPUnit/Autoload.php';
$buffer = '';
$class = new ReflectionClass('PHPUnit_Framework_Assert');
$methods = array();
foreach ($class->getMethods() as $method) {
$docblock = $method->getDocComment();
$name = $method->getName();
if (strpos($name, 'assert') === 0 || strpos($docblock, '@return PHPUnit_Framework_Constraint') !== FALSE) {
$methods[$name] = array('class' => 'PHPUnit_Framework_Assert', 'docblock' => $docblock, 'sigDecl' => str_replace(array('= false', '= true'), array('= FALSE', '= TRUE'), PHPUnit_Util_Class::getMethodParameters($method)), 'sigCall' => PHPUnit_Util_Class::getMethodParameters($method, TRUE));
}
}
$class = new ReflectionClass('PHPUnit_Framework_TestCase');
foreach ($class->getMethods() as $method) {
$docblock = $method->getDocComment();
$name = $method->getName();
if (strpos($docblock, '@return PHPUnit_Framework_MockObject_Matcher') !== FALSE || strpos($docblock, '@return PHPUnit_Framework_MockObject_Stub') !== FALSE) {
$methods[$name] = array('class' => 'PHPUnit_Framework_TestCase', 'docblock' => $docblock, 'sigDecl' => str_replace(array('= false', '= true'), array('= FALSE', '= TRUE'), PHPUnit_Util_Class::getMethodParameters($method)), 'sigCall' => PHPUnit_Util_Class::getMethodParameters($method, TRUE));
}
}
ksort($methods);
foreach ($methods as $name => $data) {
$buffer .= sprintf("\n\n%s\nfunction %s(%s)\n{\n return call_user_func_array(\n '%s::%s',\n func_get_args()\n );\n}", str_replace(' ', '', $data['docblock']), $name, $data['sigDecl'], $data['class'], $name, $data['sigCall']);
}
$template = new Text_Template(dirname(__DIR__) . '/PHPUnit/Framework/Assert/Functions.php.in');
$template->setVar(array('functions' => $buffer));
$template->renderTo(dirname(__DIR__) . '/PHPUnit/Framework/Assert/Functions.php');
示例2: generateMockedMethodDefinitionFromExisting
/**
* @param string $templateDir
* @param ReflectionMethod $method
* @return string
*/
protected static function generateMockedMethodDefinitionFromExisting($templateDir, ReflectionMethod $method)
{
if ($method->isPrivate()) {
$modifier = 'private';
} else {
if ($method->isProtected()) {
$modifier = 'protected';
} else {
$modifier = 'public';
}
}
if ($method->isStatic()) {
$static = TRUE;
} else {
$static = FALSE;
}
if ($method->returnsReference()) {
$reference = '&';
} else {
$reference = '';
}
return self::generateMockedMethodDefinition($templateDir, $method->getDeclaringClass()->getName(), $method->getName(), $modifier, PHPUnit_Util_Class::getMethodParameters($method), PHPUnit_Util_Class::getMethodParameters($method, TRUE), $reference, $static);
}
示例3: generateProxiedMethodDefinition
/**
* Generates the definition of a method to be proxied.
*
* @param string $templateDir Location of the templates to be used to create the proxy.
* @param \ReflectionMethod $method Name of the method to be reflected.
* @return array Information about the method to be proxied.
*/
protected static function generateProxiedMethodDefinition($templateDir, \ReflectionMethod $method)
{
if ($method->returnsReference()) {
$reference = '&';
} else {
$reference = '';
}
$template = self::createTemplateObject($templateDir . 'proxied_method.tpl');
$template->setVar(array('arguments_declaration' => \PHPUnit_Util_Class::getMethodParameters($method), 'arguments' => self::getMethodCallParameters($method), 'method_name' => $method->getName(), 'reference' => $reference));
return $template->render();
}
示例4: generateConstructorCodeWithParentCall
protected function generateConstructorCodeWithParentCall(ReflectionClass $class)
{
$constructor = $this->getConstructor($class);
if ($constructor) {
return sprintf(" public function __construct(%s) {\n" . " \$args = func_get_args();\n" . " \$this->invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;\n" . " \$class = new ReflectionClass(\$this);\n" . " \$class->getParentClass()->getConstructor()->invokeArgs(\$this, \$args);\n" . " }\n\n", PHPUnit_Util_Class::getMethodParameters($constructor));
} else {
return $this->generateConstructorCode($class);
}
}
示例5: array
#!/usr/bin/env php
<?php
require_once 'PHPUnit/Framework/Assert.php';
require_once 'PHPUnit/Util/Class.php';
require_once 'Text/Template.php';
if ($argc == 3) {
$methods = array();
$class = new ReflectionClass('PHPUnit_Framework_Assert');
foreach ($class->getMethods() as $method) {
$name = $method->getName();
if (strpos($name, 'assert') === 0) {
$methods[$name] = str_replace(array('= false', '= true'), array('= FALSE', '= TRUE'), PHPUnit_Util_Class::getMethodParameters($method));
}
}
ksort($methods);
$rows = '';
foreach ($methods as $methodName => $methodArguments) {
$rows .= sprintf('
<row>
<indexterm><primary>%s()</primary></indexterm>
<entry><literal>%s(%s)</literal></entry>
</row>', $methodName, $methodName, $methodArguments);
}
$template = new Text_Template($argv[1]);
$template->setVar(array('rows' => $rows));
$template->renderTo($argv[2]);
}