我是詹金斯的新手。我尝试使用这个网站上的 ci 。如果我构建我的项目,我会收到以下 consol 输出错误
phpunit:
[exec] PHPUnit 3.7.28 by Sebastian Bergmann.
[exec]
[exec] Cannot open file "/var/www/repo/project/protected/tests/bootstrap.php".
[exec]
BUILD FAILED
/var/www/repo/build.xml:117: exec returned: 1
我的 build.xml
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true">
<arg line="--log-junit ${basedir}/build/logs/phpunit.xml /var/www/repo/project/protected/" />
</exec>
</target>
我的项目结构是这样的:
-repo
-project
-protected
-components
-config
- ....
- tests
- unit
- bootstrap.php
- ReflectionTest.php
-build
-....
-build.xml
-phpunit.xml.dist
我正在使用带有命名空间的 Yii 框架。如果我从测试目录执行 phpunit 命令,它工作得很好。但如果我在其他地方执行它,我会收到如下错误:
PHP Fatal error: Class 'application\tests\ReflectionTest' not found in /var/www/repo/project/protected/tests/unit/account/manager/ManagerTest.php on line 13
这是我的测试:
<?php
namespace application\tests\unit\account\manager;
use application\modules\account\manager\Manager;
use application\models;
use Yii;
use application\tests\ReflectionTest;
/**
* This class test the protected and public methods of SignupManager
*/
class ManagerTest extends ReflectionTest {
这里是我的 phpunit.xml.dist
<phpunit bootstrap="project/protected/tests/bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<selenium>
<browser name="Internet Explorer" browser="*iexplore" />
<browser name="Firefox" browser="*firefox" />
</selenium>
<testsuites>
<testsuite name="Project Test Suite">
<directory>project/protected/tests/*</directory>
</testsuite>
</testsuites>
</phpunit>
我的错误在哪里?