phpunitテストが含まれている、小さなWebアプリケーションが稼働しています。これは、作曲で構築され、そしてかなり標準的なディレクトリ構造を持っています:なぜグローバルphpunitはxml構成ファイルを無視しますか?
src/
application files
tests/
bootstrap.php
test files
web/
index.php
.travis.yml
composer.json
composer.lock
phpunit.xml
phpunit.xml内容:
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit boostrap="./tests/bootstrap.php">
<testsuites>
<testsuite name="Chronos">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
bootstrap.phpの内容:
<?php
require __DIR__ . "/../vendor/autoload.php";
私の問題を
次のコマンドを実行すると完全に動作し、テストにパスします:
私のプロジェクトのルートディレクトリにはPHPUnitのグローバルインストールを実行すると/含ま私はPHPUnitを解決しないように思わ$ phpunit
PHPUnit 4.8.26 by Sebastian Bergmann and contributors.
EE
Time: 117 ms, Memory: 4.00MB
There were 2 errors:
1) WelcomeTest::testReturnsAPayload
Error: Class 'Equip\Payload' not found
/Users/tony/Documents/projects/chronos/tests/Domain/WelcomeTest.php:13
2) WelcomeTest::testReturnsOkStatus
Error: Class 'Equip\Payload' not found
/Users/tony/Documents/projects/chronos/tests/Domain/WelcomeTest.php:13
FAILURES!
Tests: 2, Assertions: 0, Errors: 2.
:私はPHPUnitの私のグローバルインストールされたバージョンを実行したときに
$ vendor/bin/phpunit
PHPUnit 4.8.26 by Sebastian Bergmann and contributors.
..
Time: 104 ms, Memory: 4.00MB
OK (2 tests, 2 assertions)
しかし、それは失敗します。 xmlファイル(オートローダーを指定します)。 TravisCIについても同じ結果が得られます。
これはなぜ起こっているのですか?私は自分の.travis.ymlファイルにphpunitのローカルバージョンを指定することができますが、ここで何が違うのかを知っています。
エラーメッセージ全体を投稿する –
出力を含むように更新 – maherio
phpunit.xmlの関連部分を投稿してください。ブートストラップファイルにパス関連の問題がある可能性があります。ブートストラップファイル(またはコマンド)も同様に投稿してください。 –