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


PHP Environment::checkAssertions方法代码示例

本文整理汇总了PHP中Environment::checkAssertions方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::checkAssertions方法的具体用法?PHP Environment::checkAssertions怎么用?PHP Environment::checkAssertions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Environment的用法示例。


在下文中一共展示了Environment::checkAssertions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Runs the test case.
  * @return void
  */
 public function run($method = NULL)
 {
     $r = new \ReflectionObject($this);
     $methods = array_values(preg_grep(self::METHOD_PATTERN, array_map(function (\ReflectionMethod $rm) {
         return $rm->getName();
     }, $r->getMethods())));
     if (($method === NULL || $method === self::LIST_METHODS) && isset($_SERVER['argv'][1])) {
         if ($_SERVER['argv'][1] === self::LIST_METHODS) {
             Environment::$checkAssertions = FALSE;
             header('Content-Type: application/json');
             echo json_encode($methods);
             return;
         }
         $method = $_SERVER['argv'][1];
     }
     if ($method === NULL) {
         foreach ($methods as $method) {
             $this->runMethod($method);
         }
     } elseif (in_array($method, $methods)) {
         $this->runMethod($method);
     } else {
         throw new TestCaseException("Method '{$method}' does not exist or it is not a testing method.");
     }
 }
开发者ID:xnovk,项目名称:test,代码行数:29,代码来源:TestCase.php

示例2: run

 /**
  * Runs the test case.
  * @return void
  */
 public function run($method = NULL)
 {
     $r = new \ReflectionObject($this);
     $methods = array_values(preg_grep(self::METHOD_PATTERN, array_map(function (\ReflectionMethod $rm) {
         return $rm->getName();
     }, $r->getMethods())));
     if (substr($method, 0, 2) === '--') {
         // back compatibility
         $method = NULL;
     }
     if ($method === NULL && isset($_SERVER['argv']) && ($tmp = preg_filter('#(--method=)?([\\w-]+)$#Ai', '$2', $_SERVER['argv']))) {
         $method = reset($tmp);
         if ($method === self::LIST_METHODS) {
             Environment::$checkAssertions = FALSE;
             header('Content-Type: text/plain');
             echo '[' . implode(',', $methods) . ']';
             return;
         }
     }
     if ($method === NULL) {
         foreach ($methods as $method) {
             $this->runMethod($method);
         }
     } elseif (in_array($method, $methods, TRUE)) {
         $this->runMethod($method);
     } else {
         throw new TestCaseException("Method '{$method}' does not exist or it is not a testing method.");
     }
 }
开发者ID:jave007,项目名称:test,代码行数:33,代码来源:TestCase.php

示例3: run

 /**
  * Runs the test case.
  * @return void
  */
 public function run()
 {
     if (func_num_args()) {
         throw new \LogicException('Calling TestCase::run($method) is deprecated. Use TestCase::runTest($method) instead.');
     }
     $methods = array_values(preg_grep(self::METHOD_PATTERN, array_map(function (\ReflectionMethod $rm) {
         return $rm->getName();
     }, (new \ReflectionObject($this))->getMethods())));
     if (isset($_SERVER['argv']) && ($tmp = preg_filter('#--method=([\\w-]+)$#Ai', '$1', $_SERVER['argv']))) {
         $method = reset($tmp);
         if ($method === self::LIST_METHODS) {
             Environment::$checkAssertions = FALSE;
             header('Content-Type: text/plain');
             echo '[' . implode(',', $methods) . ']';
             return;
         }
         $this->runTest($method);
     } else {
         foreach ($methods as $method) {
             $this->runTest($method);
         }
     }
 }
开发者ID:nette,项目名称:tester,代码行数:27,代码来源:TestCase.php


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