本文整理汇总了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.");
}
}
示例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.");
}
}
示例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);
}
}
}