本文整理汇总了PHP中PHPUnit_Framework_TestCase::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::__call方法的具体用法?PHP PHPUnit_Framework_TestCase::__call怎么用?PHP PHPUnit_Framework_TestCase::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestCase
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestCase::__call方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __call($func, $args)
{
if (isset(self::$aliased_methods[$func])) {
$method = self::$aliased_methods[$func];
return call_user_func_array(array($this, $method), $args);
} else {
if (self::$alias_call_parent__call) {
parent::__call($func, $args);
} else {
trigger_error('No such function: ' . get_class($this) . "::{$func}");
}
}
}
示例2: __call
/**
* PHP magic method.
* This method is overridden so that named fixture ActiveRecord instances can be accessed in terms of a method call.
* @param string $name method name
* @param string $params method parameters
* @return mixed the property value
*/
public function __call($name, $params)
{
if (is_array($this->fixtures) && isset($params[0]) && ($record = $this->getFixtureManager()->getRecord($name, $params[0])) !== false) {
return $record;
} elseif (method_exists($this->webdriver, $name)) {
return call_user_func_array(array($this->webdriver, $name), $params);
} else {
return parent::__call($name, $params);
}
}
示例3: __call
/**
* This overload is useful to create a stub, that need to have a specific method.
*/
public function __call($method, $args)
{
if ($this->{$method} instanceof Closure) {
return call_user_func_array($this->{$method}, $args);
} else {
return parent::__call($method, $args);
}
}
示例4: __call
/**
* NOTE: Makes calling any PHPUnit assertXXX magically pass thru our controller pre-processor with the following suffixes:
* - TemplateVar => Looks up the variable in the page template. Pass a templateVar name as the "expected" param
* - SharedInstance => Looks up the SharedInstance.keyPath. Pass 2 args (SharedInstance, KeyPath) in place of the "expected" param
*
* @method PhocoaControllerTestCase_PHPUnit::assertEqualsFromTemplateVar($expectedVal, $actualFromTemplateVarName, $msg)
* @method PhocoaControllerTestCase_PHPUnit::assertEqualsFromSharedInstance($expectedVal, $actualSharedInstanceName, $actualSharedInstanceKeyPath, $msg)
* @method PhocoaControllerTestCase_PHPUnit::assertRegExpFromPageOutput($expectedVal, $regex, $msg)
* @method PhocoaControllerTestCase_PHPUnit::assertEqualsFromResponseTemplate($expectedVal, $templateFileName, $msg)
*/
public function __call($method, $args)
{
if (preg_match('/^(assert.+)From(TemplateVar|SharedInstance|PageOutput|ResponseTemplate)$/', $method, $matches)) {
$assertComparator = $matches[1];
$varGetterType = $matches[2];
switch ($varGetterType) {
case 'TemplateVar':
$actualFromTemplateVarName = $args[1];
$actual = $this->_getTemplateVar($actualFromTemplateVarName);
return call_user_func_array(array($this, $assertComparator), $this->_buildPHPUnitAssertArgs($assertComparator, $args, $actual));
case 'SharedInstance':
$sharedInstanceName = $args[1];
$sharedInstanceKeyPath = isset($args[2]) ? $args[2] : NULL;
$actual = $this->_getSharedInstanceValue($sharedInstanceName, $sharedInstanceKeyPath);
return call_user_func_array(array($this, $assertComparator), $this->_buildPHPUnitAssertArgs($assertComparator, $args, $actual, 2));
case 'PageOutput':
$actual = $this->pageOutput;
return call_user_func_array(array($this, $assertComparator), $this->_buildPHPUnitAssertArgs($assertComparator, $args, $actual));
break;
case 'ResponseTemplate':
$actual = basename($this->module->responsePage()->template()->template());
return call_user_func_array(array($this, $assertComparator), $this->_buildPHPUnitAssertArgs($assertComparator, $args, $actual));
break;
}
}
// seems a little odd, dies HERE if parent doesn't define __call, but doesn't matter b/c it dies when an unexpected method is encountered
return parent::__call($method, $args);
}