How to downgrade PHPUnit to 4.8.0?

php

#1

My project runs on PHP 5.5 and thus we are using this in circle.yml:

machine:
   php:
     version: 5.5.31

I am getting this error while running phpunit:

$ phpunit
This version of PHPUnit requires PHP 5.6; using the latest version of PHP is highly recommended.

phpunit returned exit code 1

I don’t have any plans to upgrade my project to PHP 5.6 yet. Is there anyway I can change the phpunit version to the one that supports 5.5, i.e. phpunit 4.8.0 and how?


Phpunit/dbunit not loaded anymore ? How to load it?
#2

I would advise removing phpunit and then installing the version you need in your dependencies section on circle.yml.

The directions to install a certain version are here: http://askubuntu.com/questions/428772/how-to-install-specific-version-of-some-package/428778

dependencies:
  pre:
    - sudo apt-get install package=<version>

You can also use Composer: https://phpunit.de/manual/current/en/installation.html


#3

Thanks! This is what I’m doing. I did not remove and install a different version. But downloaded the target version into the working directory and run from there.

machine:
   php:
     version: 5.5.31
dependencies:
  post:
    - wget https://phar.phpunit.de/phpunit-old.phar
    - chmod +x phpunit-old.phar
    - mv phpunit-old.phar phpunit
test:
  override:
    - mkdir -p $CIRCLE_TEST_REPORTS/phpunit
    - ./phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit.xml

It’s working great.


#4