Rumah > pembangunan bahagian belakang > tutorial php > ubuntu - jenkins自动构建laravel 4时,phpunit执行时vendor/autoload.php报语法错误

ubuntu - jenkins自动构建laravel 4时,phpunit执行时vendor/autoload.php报语法错误

WBOY
Lepaskan: 2016-06-06 20:40:18
asal
1223 orang telah melayarinya

在同一个环境下,php在终端使用ant构建项目执行phpunit测试没有问题,但是在jenkins自动构建时会报错:
<br> phpunit:<br> [exec] PHP Parse error: syntax error, unexpected ' [exec] PHP Stack trace:<br> [exec] PHP 1. {main}() /usr/local/bin/phpunit:0<br> [exec] PHP 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:612<br> [exec] PHP 3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:138<br> [exec] PHP 4. PHPUnit_TextUI_Command->handleArguments() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:148<br> [exec] PHP 5. PHPUnit_TextUI_Command->handleBootstrap() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:651<br> [exec] PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:817<br> [exec] PHP 7. PHPUnit_Util_Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:77<br> [exec] PHP 8. include_once() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:93

BUILD FAILED
/var/lib/jenkins/jobs/hwawoontest/workspace/build.xml:168: exec returned: 255


autoload.php的代码:
<br> <?php <br> // autoload.php @generated by Composer<br> require_once <strong>DIR</strong> . '/composer' . '/autoload_real.php';<br> return ComposerAutoloaderInit34c7d9c593778809996626035f6ae5ee::getLoader();<br>

下面这一段是build.xml的代码片段:

<code><target name="phpunit" description="Run unit tests with PHPUnit">
    <exec executable="phpunit" failonerror="true">
        <arg value="-c"></arg>
        <arg value="${basedir}/phpunit.xml.dist"></arg>
        <arg value="--coverage-html"></arg>
        <arg value="${basedir}/build/coverage"></arg>
    </exec>
</target>
</code>
Salin selepas log masuk
Salin selepas log masuk

为什么会这样,哪里有问题?

回复内容:

在同一个环境下,php在终端使用ant构建项目执行phpunit测试没有问题,但是在jenkins自动构建时会报错:
<br> phpunit:<br> [exec] PHP Parse error: syntax error, unexpected ' [exec] PHP Stack trace:<br> [exec] PHP 1. {main}() /usr/local/bin/phpunit:0<br> [exec] PHP 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:612<br> [exec] PHP 3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:138<br> [exec] PHP 4. PHPUnit_TextUI_Command->handleArguments() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:148<br> [exec] PHP 5. PHPUnit_TextUI_Command->handleBootstrap() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:651<br> [exec] PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:817<br> [exec] PHP 7. PHPUnit_Util_Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:77<br> [exec] PHP 8. include_once() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:93

BUILD FAILED
/var/lib/jenkins/jobs/hwawoontest/workspace/build.xml:168: exec returned: 255


autoload.php的代码:
<br> <?php <br> // autoload.php @generated by Composer<br> require_once <strong>DIR</strong> . '/composer' . '/autoload_real.php';<br> return ComposerAutoloaderInit34c7d9c593778809996626035f6ae5ee::getLoader();<br>

下面这一段是build.xml的代码片段:

<code><target name="phpunit" description="Run unit tests with PHPUnit">
    <exec executable="phpunit" failonerror="true">
        <arg value="-c"></arg>
        <arg value="${basedir}/phpunit.xml.dist"></arg>
        <arg value="--coverage-html"></arg>
        <arg value="${basedir}/build/coverage"></arg>
    </exec>
</target>
</code>
Salin selepas log masuk
Salin selepas log masuk

为什么会这样,哪里有问题?

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan