无法全局安装较早版本的phpunit phar [英] Unable to globally install older version of phpunit phar

查看:159
本文介绍了无法全局安装较早版本的phpunit phar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://phpunit.de/manual中所述/current/en/installation.html#installation.phar.verification ,则全局安装PHAR的步骤是:

As given in https://phpunit.de/manual/current/en/installation.html#installation.phar.verification, the steps to globally install the PHAR are:

$ wget https://phar.phpunit.de/phpunit.phar
$ chmod +x phpunit.phar
$ sudo mv phpunit.phar /usr/local/bin/phpunit
$ phpunit --version
PHPUnit x.y.z by Sebastian Bergmann and contributors.

我遵循了上面的内容,但是使用了旧版本的URL,即 https://phar .phpunit.de/phpunit-old.phar (因为我们的PHP版本较旧).然后我运行了以下命令-

I followed the above, but with the URL for the older version, i.e. https://phar.phpunit.de/phpunit-old.phar (because our PHP version is older). I ran the following commands then -

$ chmod +x phpunit-old.phar
$ sudo mv phpunit-old.phar /usr/local/bin/phpunit

注意-我的PHP版本是5.3.29. phpunit.de中的旧稳定版"部分说,PHP 5.3,PHP 5.4,PHP 5.5和PHP 5.6支持PHPUnit 4.8.

看起来很好,到这里为止.但是,运行phpunit --version可以得到-

Looks fine till here. But, running phpunit --version gives -

PHP Fatal error:  require(): Cannot redeclare class phpunit_extensions_database_constraint_tableisequal in /usr/local/bin/phpunit on line 109
zend_mm_heap corrupted

因此,我没有运行.phar/usr/local/bin/(在第3步中),而是通过运行此命令进行了到目前为止的管理-

So, instead of moving the .phar to /usr/local/bin/ (in the step 3), I was managing so far by running this -

$ php phpunit-old.phar –-version 

我也能够以这种方式运行单元测试用例-

I was also able to run my unit test cases in this way -

php /home/sandeepan/phpunit-old.phar /var/cake_1.2.0.6311-beta/app/webroot/openx/lib/ad_agencies/unittests/Admarvel_generic_network_test.php

但是,现在我需要将phpunit与phing集成在一起.我想使用 phing的PHPUnitTask 提供的基本实用程序.因此,我想它需要phpunit phar进行全局安装.

But, now I need to integrate phpunit with phing. I would like to use the basic utilities provided by PHPUnitTask of phing. So, I guess it needs phpunit phar to be globally installed.

我通过写以下代码来尝试运气-

I tried my luck by writing the following -

<phpunit haltonfailure="true" haltonerror="true" 
                                            pharlocation="/home/sandeepan/phpunit-old">
    <formatter type="plain" usefile="false" />
    <batchtest>
        <fileset dir="${dir.scratchpad}/${dir.subdir}/unittests">
            <include name="**/*_test.php"/>
        </fileset>
    </batchtest>
</phpunit>

但是我收到此错误-

BUILD FAILED
...
: PHPUnitTask requires PHPUnit to be installed

更新

参考stackoverflow.com/a/23410676/351903,我尝试使用此较旧版本的Phpunit,即PHPUnit-3.7.35.现在,phpunit --version命令起作用.但是使用Phing的PHPUnitTask仍然没有成功.仍然出现PHPUnitTask requires PHPUnit to be installed错误.

With reference to stackoverflow.com/a/23410676/351903, I tried with this older version of Phpunit, i.e. PHPUnit-3.7.35. Now, phpunit --version command works. But I still have no success using the PHPUnitTask of Phing. Still getting PHPUnitTask requires PHPUnit to be installed error.

更新2

最适合我的解决方案是使用PHPUnit 3.7.35.似乎存在与PHPUnit 4.8的phing的兼容性问题.

The solution which worked for me was using PHPUnit 3.7.35. It seems there is some compatibility issue of phing with PHPUnit 4.8.

推荐答案

最适合我的解决方案是使用PHPUnit 3.7.35.似乎存在与PHPUnit 4.8的phing的兼容性问题.

The solution which worked for me was using PHPUnit 3.7.35. It seems there is some compatibility issue of phing with PHPUnit 4.8.

来源- Phing看不到PHPUnit

这篇关于无法全局安装较早版本的phpunit phar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆