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

查看:15
本文介绍了无法全局安装旧版本的 phpunit 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.

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

Note - My PHP version is 5.3.29. and the Old Stable Release section in phpunit.de says PHPUnit 4.8 is supported on PHP 5.3, PHP 5.4, PHP 5.5, and PHP 5.6.

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

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

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>

But I get this error -

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

Update

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.

Update 2

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.

解决方案

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.

Source - Phing can't see PHPUnit

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

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