dongxi2014 2016-03-16 18:00
浏览 113
已采纳

什么是PHP CI构建路径

I've successfully installed PHPCI on my local server, setup a project, and run my first build.

Even without a phpci.yml, PHP CI seems to detect my Codeception tests (yay!)

However, the build log contains the following text

Exception: Warning: file_get_contents(/tests/_output/report.tap.log): failed to open stream: No such file or directory in /path/to/Sites/php-ci/phpci/PHPCI/Plugin/Codeception.php line 94 PLUGIN: FAILED

When I take a look at line 94, I see the following

$tapString = file_get_contents(
    $this->phpci->buildPath . $this->logPath . DIRECTORY_SEPARATOR . 'report.tap.log'
);

PHPCI seems to be building a path with the $this->phpci->buildPath.

What is this path? Is it the PHP CI path? The path of my repository? A third working area that can be anywhere?

Where in PHP CI do I set this path? Per project in the phpci.yml? Somewhere in the admin?

  • 写回答

1条回答 默认 最新

  • duandie0884 2017-02-20 18:36
    关注

    I've found your question on my search for answers regarding PHPCI.

    I don't know if you still need your answer, but I'll post it for anyone else who's wondering.

    To answer your questions:

    • "What is this path?" It's a uniquely generated path for each build.
    • "Is it the PHP CI path?" No
    • "The path of my repository?" No
    • "A third working area that can be anywhere?" Not exactly anywhere, but yes.

    "Where in PHP CI do I set this path?"
    Well, to answer that I dug deeper into their source code and I found, that the original path is set up by the following PHP Code:

     $buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
     $this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DIRECTORY_SEPARATOR;
    

    The generated path would therefore be the builds' ID and a (more or less) unique part. Important here is the defined constant PHPCI_BUILD_ROOT_DIR which is defined in the file vars.php in your installation directory:

    // Define PHPCI_BUILD_ROOT_DIR
    if (!defined('PHPCI_BUILD_ROOT_DIR')) {
        define('PHPCI_BUILD_ROOT_DIR', PHPCI_DIR . 'PHPCI/build/');
    }
    

    So the directory would by default be a temporary folder called
    path/to/phpci/PHPCI/build/4_31370/

    This folder will of course be deleted again, as soon as the build is finished.

    I've then changed the definition of the folder to
    define('PHPCI_BUILD_ROOT_DIR', PHPCI_DIR . 'tempbuilddir/');
    which gives me the following build temporary build directory:
    path/to/phpci/tempbuilddir/6_65873/

    So this directory is completely customizable.

    Nevertheless the Codeception plugin seems to have changed since your version, as the filename report.tap.log doesn't appear to be in the source code anymore.

    I hope this answer gave you an understanding of the PHPCI build directory configuration. It certainly helped me to find this out.

    展开全部

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部