首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gitlab ci composer的php测试

gitlab ci composer的php测试
EN

Stack Overflow用户
提问于 2017-02-27 03:53:17
回答 1查看 846关注 0票数 0

我正在尝试用我的小php代码做一些基本的静态分析。我想使用: phploc phpcpd phpcs

我的项目文件夹结构如下:

代码语言:javascript
复制
    .
    |-- ci
    |   `-- docker_install.sh
    |-- css
    |   `-- css.css
    |-- index.php
    |-- js
    |   |-- icons.json
    |   `-- script.js
    `-- process.php

我用以下代码创建了shell脚本docker_install.sh:

代码语言:javascript
复制
# Install git (the php image doesn't have it) and other tools
apt-get update -yqq
apt-get install git phploc phpcpd phpmd php-pear -yqq

#install composer
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer  

和我的构建文件:

代码语言:javascript
复制
  image: php:7.0
  before_script:
    #insatll needed packeges
    - bash ci/docker_install.sh > /dev/null
  test:app:
    script:
      #Static analysis
      - phploc .
      #phpmd check coding style
      - phpmd . text naming
      #checking Coding Standards with PHP Code Sniffer
      - phpcpd .
      #Viewing Coding Standards Violations
      - phpcs --standard=PEAR --report=summaryy

带有以下错误的构建文件:

代码语言:javascript
复制
  ....
  $ phpcpd .

  Warning: require_once(Symfony/Component/ClassLoader/ClassLoader.php): failed to open stream: No such file or directory in /usr/share/php/SebastianBergmann/PHPCPD/autoload.php on line 2

  Fatal error: require_once(): Failed opening required 'Symfony/Component/ClassLoader/ClassLoader.php' (include_path='.:/usr/local/lib/php') in /usr/share/php/SebastianBergmann/PHPCPD/autoload.php on line 2
  ERROR: Build failed: exit code 1

我的问题:如何增强这一点,以及如何使其发挥作用?

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2017-02-27 20:01:53

您安装了composer,但从未运行过composer install。只需将其添加到docker_install.sh文件的末尾即可。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42473436

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档