当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestCase::__call方法代码示例

本文整理汇总了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}");
         }
     }
 }
开发者ID:robnormal,项目名称:php-functional-chat,代码行数:13,代码来源:RR_PHPUnit_TestCase.class.php

示例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);
     }
 }
开发者ID:oguzhandemiroz,项目名称:selenium,代码行数:17,代码来源:CWebDriverTestCase.php

示例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);
     }
 }
开发者ID:madwings,项目名称:insanedb,代码行数:11,代码来源:ci_testcase.php

示例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);
 }
开发者ID:apinstein,项目名称:phocoa,代码行数:38,代码来源:PhocoaControllerTestCase_PHPUnit.php


注:本文中的PHPUnit_Framework_TestCase::__call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。