• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP testing_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中testing_error函数的典型用法代码示例。如果您正苦于以下问题:PHP testing_error函数的具体用法?PHP testing_error怎么用?PHP testing_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: behat_error

/**
 * Exits with an error code
 *
 * @param  mixed $errorcode
 * @param  string $text
 * @return void Stops execution with error code
 */
function behat_error($errorcode, $text = '')
{
    // Adding error prefixes.
    switch ($errorcode) {
        case BEHAT_EXITCODE_CONFIG:
            $text = 'Behat config error: ' . $text;
            break;
        case BEHAT_EXITCODE_REQUIREMENT:
            $text = 'Behat requirement not satisfied: ' . $text;
            break;
        case BEHAT_EXITCODE_PERMISSIONS:
            $text = 'Behat permissions problem: ' . $text . ', check the permissions';
            break;
        case BEHAT_EXITCODE_REINSTALL:
            $path = testing_cli_argument_path('/testing/frameworks/behat/cli/init.php');
            $text = "Reinstall Behat: " . $text . ", use:\n php " . $path;
            break;
        case BEHAT_EXITCODE_INSTALL:
            $path = testing_cli_argument_path('/testing/frameworks/behat/cli/init.php');
            $text = "Install Behat before enabling it, use:\n php " . $path;
            break;
        case BEHAT_EXITCODE_INSTALLED:
            $text = "The Behat site is already installed";
            break;
        default:
            $text = 'Unknown error ' . $errorcode . ' ' . $text;
            break;
    }
    testing_error($errorcode, $text);
}
开发者ID:rboyatt,项目名称:mahara,代码行数:37,代码来源:lib.php


示例2: phpunit_bootstrap_error

/**
 * Print error and stop execution
 * @param int $errorcode The exit error code
 * @param string $text An error message to display
 * @return void stops code execution with error code
 */
function phpunit_bootstrap_error($errorcode, $text = '')
{
    switch ($errorcode) {
        case 0:
            // this is not an error, just print information and exit
            break;
        case 1:
            $text = 'Error: ' . $text;
            break;
        case PHPUNIT_EXITCODE_PHPUNITMISSING:
            $text = "Can not find PHPUnit library, to install use: php composer.phar install";
            break;
        case PHPUNIT_EXITCODE_PHPUNITWRONG:
            $text = 'Moodle requires PHPUnit 3.6.x, ' . $text . ' is not compatible';
            break;
        case PHPUNIT_EXITCODE_PHPUNITEXTMISSING:
            $text = 'Moodle can not find required PHPUnit extension ' . $text;
            break;
        case PHPUNIT_EXITCODE_CONFIGERROR:
            $text = "Moodle PHPUnit environment configuration error:\n" . $text;
            break;
        case PHPUNIT_EXITCODE_CONFIGWARNING:
            $text = "Moodle PHPUnit environment configuration warning:\n" . $text;
            break;
        case PHPUNIT_EXITCODE_INSTALL:
            $path = testing_cli_argument_path('/admin/tool/phpunit/cli/init.php');
            $text = "Moodle PHPUnit environment is not initialised, please use:\n php {$path}";
            break;
        case PHPUNIT_EXITCODE_REINSTALL:
            $path = testing_cli_argument_path('/admin/tool/phpunit/cli/init.php');
            $text = "Moodle PHPUnit environment was initialised for different version, please use:\n php {$path}";
            break;
        default:
            $text = empty($text) ? '' : ': ' . $text;
            $text = 'Unknown error ' . $errorcode . $text;
            break;
    }
    testing_error($errorcode, $text);
}
开发者ID:evltuma,项目名称:moodle,代码行数:45,代码来源:bootstraplib.php


示例3: get_tablestructure

    /**
     * Returns structure of all tables right after installation.
     * @static
     * @return array $table=>$records
     */
    public static function get_tablestructure() {
        global $CFG;

        $framework = self::get_framework();

        $structurefile = $CFG->dataroot . '/' . $framework . '/tablestructure.ser';
        if (!file_exists($structurefile)) {
            // Not initialised yet.
            return array();
        }

        if (!isset(self::$tablestructure)) {
            $data = file_get_contents($structurefile);
            self::$tablestructure = unserialize($data);
        }

        if (!is_array(self::$tablestructure)) {
            testing_error(1, 'Can not read dataroot/' . $framework . '/tablestructure.ser or invalid format, reinitialize test database.');
        }

        return self::$tablestructure;
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:27,代码来源:util.php


示例4: get_table_structure

 /**
  * Returns structure of all tables right after installation.
  * @static
  * @param string $statename name of state.
  * @return array $table=>$records
  */
 public static function get_table_structure($statename)
 {
     $structurefile = util::get_tool_dir() . DIRECTORY_SEPARATOR . $statename . "_structure.ser";
     if (!file_exists($structurefile)) {
         // Not initialised yet.
         return array();
     }
     if (!isset(self::$tablestructure)) {
         $data = file_get_contents($structurefile);
         self::$tablestructure = unserialize($data);
     }
     if (!is_array(self::$tablestructure)) {
         testing_error(1, 'Can not read dataroot/' . $statename . '_structure.ser or invalid format, reinitialize test database.');
     }
     return self::$tablestructure;
 }
开发者ID:rajeshtaneja,项目名称:moodle-performance-toolkit,代码行数:22,代码来源:installer.php


示例5: testing_update_composer_dependencies

/**
 * Updates the composer installer and the dependencies.
 *
 * @return void exit() if something goes wrong
 */
function testing_update_composer_dependencies()
{
    // To restore the value after finishing.
    $cwd = getcwd();
    // Set some paths.
    $dirroot = dirname(dirname(__DIR__));
    $composerpath = $dirroot . DIRECTORY_SEPARATOR . 'composer.phar';
    $composerurl = 'https://getcomposer.org/composer.phar';
    // Switch to Moodle's dirroot for easier path handling.
    chdir($dirroot);
    // Download or update composer.phar. Unfortunately we can't use the curl
    // class in filelib.php as we're running within one of the test platforms.
    if (!file_exists($composerpath)) {
        $file = @fopen($composerpath, 'w');
        if ($file === false) {
            $errordetails = error_get_last();
            $error = sprintf("Unable to create composer.phar\nPHP error: %s", $errordetails['message']);
            testing_error(TESTING_EXITCODE_COMPOSER, $error);
        }
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $composerurl);
        curl_setopt($curl, CURLOPT_FILE, $file);
        $result = curl_exec($curl);
        $curlerrno = curl_errno($curl);
        $curlerror = curl_error($curl);
        $curlinfo = curl_getinfo($curl);
        curl_close($curl);
        fclose($file);
        if (!$result) {
            $error = sprintf("Unable to download composer.phar\ncURL error (%d): %s", $curlerrno, $curlerror);
            testing_error(TESTING_EXITCODE_COMPOSER, $error);
        } else {
            if ($curlinfo['http_code'] === 404) {
                if (file_exists($composerpath)) {
                    // Deleting the resource as it would contain HTML.
                    unlink($composerpath);
                }
                $error = sprintf("Unable to download composer.phar\n" . "404 http status code fetching {$composerurl}");
                testing_error(TESTING_EXITCODE_COMPOSER, $error);
            }
        }
    } else {
        passthru("php composer.phar self-update", $code);
        if ($code != 0) {
            exit($code);
        }
    }
    // Update composer dependencies.
    passthru("php composer.phar install", $code);
    if ($code != 0) {
        exit($code);
    }
    // Return to our original location.
    chdir($cwd);
}
开发者ID:evltuma,项目名称:moodle,代码行数:60,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP testing_fix_file_permissions函数代码示例发布时间:2022-05-23
下一篇:
PHP tester_url_absolue函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap