Travis错误地给出了失败的测试

时间:2014-06-08 12:58:02

标签: php phpunit travis-ci

我是travis-ci的新手,但我无法理解为什么通过的测试失败了。

以下是该方案。我在github上有一个repo,这样结构

 src/
   repo_name/
      /foo.class.php

test/
  bootstrap.php
  repo_name/
      testFoo.class.php
.travis.yml
phpunit.xml
composer.json

以下是.travis.yml

的内容
language: php
php:
  - 5.5
  - 5.4

以下是phpunit.xml

的内容
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         syntaxCheck="false"
         bootstrap="test/bootstrap.php"
        >
    <testsuites>
        <testsuite name="First Tests">
            <directory>./test/</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>./src/</directory>
        </whitelist>
    </filter>
</phpunit>

boostrap.php只需要src/repo_name/foo.class.php testFoo.class.php具有标准的PHPUnit测试方法。

我真的不认为我的文件有什么问题,因为我已经多次运行测试了,它没有任何问题。我正确地收到失败/传递消息。

可能出现什么问题?

更新

这是错误消息,我来自travis

Using worker: worker-linux-8-1.bb.travis-ci.org:travis-linux-20

git.1

$ git clone --depth=50 --branch=master git://github.com/repo_name/repo_name.git repo_name/repo_name

Cloning into 'repo_name/repo_name'...

remote: Counting objects: 252, done.

remote: Compressing objects: 100% (216/216), done.

remote: Total 252 (delta 89), reused 2 (delta 0)

Receiving objects: 100% (252/252), 51.10 KiB | 0 bytes/s, done.

Resolving deltas: 100% (89/89), done.

Checking connectivity... done.

$ cd repo_name/repo_name
git.3

$ git checkout -qf 1689bb68fb95a52d859fdc7c309a9c5f41c6df85

$ phpenv global 5.5

$ php --version

PHP 5.5.11 (cli) (built: May 1 2014 01:40:45)

Copyright (c) 1997-2014 The PHP Group

Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans

$ composer --version

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/home/travis/.phpenv/versions/5.5/bin/composer self-update" to get the latest version.

Composer version 6ffd34db9054fe89e5d3b51f6b4178c9010b4afa 2014-04-30 11:03:37
before_install

$ git submodule update --init --recursive

$ phpunit

PHPUnit 4.0.19 by Sebastian Bergmann.

Cannot open file "/home/travis/build/repo_name/repo_name/test/bootstrap.php".

The command "phpunit" exited with 1.

Done. Your build exited with 1.

1 个答案:

答案 0 :(得分:0)

必须是它不能包含引导程序文件。 无法打开文件&#34; /home/travis/build/repo_name/repo_name/test/bootstrap.php"。

我不会只将script: phpunit放在.travis.yml中,而是放在:

script: phpunit --configuration phpunit.xml

我对此进行了测试,它适用于您的设置。