特拉维斯找不到源文件

时间:2015-09-26 22:16:15

标签: php phpunit travis-ci

对于php库,我使用travis-ci.org。我的.travis.yml文件如下:

language: php
sudo: false
matrix:
    include:
        - php: 5.3.3
        - php: 5.3
        - php: 5.3
          env: deps=low
        - php: 5.4
        - php: 5.5
        - php: 5.6
        - php: 7
        - php: hhvm
    fast_finish: true
before_script:
    - cp phpunit.xml.dist phpunit.xml
    - composer update
    - mkdir -p log/codeCoverage
script: phpunit

我的PHP单元在travis服务器上失败(本地传递),但出现以下错误:

Fatal error: Class 'Phpreboot\Stopwatch\StopWatch' not found in /home/travis/build/phpreboot/stopwatch/tests/Phpreboot/Stopwatch/StopWatchTest.php on line 31

问题:有人可以告诉我为什么只有特拉维斯失败吗?

来源 - StopWatchTest.php

//line 14
use Phpreboot\Stopwatch\StopWatch;

//line 29-32
public function setUp()
{
    $this->stopWatch = new StopWatch(); //Error showing here.
    // Using PSR-4 as shown in below composer.json.
}

来源composer.json

{
  "name": "phpreboot/stopwatch",
  "description": "PHP utility library for Stopwatch. Useful for optimization and other purpose.",
  "keywords": ["stopwatch", "timer"],
  "license": "MIT",
  "authors": [
    {
      "name": "kapilsharma",
      "email": "***********",
      "homepage": "http://blog.kapilsharma.info",
      "role": "Developer"
    }
  ],
  "support": {
    "issues": "https://github.com/phpreboot/stopwatch/issues"
  },
  "autoload": {
    "psr-4": {"Phpreboot\\": "src/PhpReboot"}
  },
  "autoload-dev": {
    "psr-4": {"Phpreboot\\": "tests/PhpReboot"}
  },
  "require": {},
  "require-dev": {
    "phpunit/phpunit": "~4.8"
  }
}

测试结果 - https://travis-ci.org/phpreboot/stopwatch/jobs/82350524(检查第226行)

1 个答案:

答案 0 :(得分:1)

看起来你的自动加载是错误的。请参阅src/PhpReboot以及目录名称。它应该是src/Phpreboot更多的不是特拉维斯问题。