dimanche 17 juin 2018

Testing old PHP versions with PHPUnit 7

I am using Composer for dependencies.

My project's dependencies require PHP 5.5 or later, so I want to test my project on PHP 5.5 - 7.2 (latest) with PHPUnit 7.

I set up Travis CI tests with different PHP versions:

language: php
php:
  - '5.5'
  - '5.6'
  - '7.0'
  - '7.1'
  - '7.2'
  - hhvm # on Trusty only
  - nightly

The problem is that the PHPUnit 7 requires PHP 7.1, so I can't test project on PHP 5.5 - 7.0.

I could test old PHP versions with old PHPUnit versions, but the problem is that after PHPUnit 6, PHPUnit's units of code are namespaced, so I will have to write different tests for PHPUnit 4 - 5 and PHPUnit 6 - 7.

How can I test my project on old PHP versions with PHPUnit 7 with Travis CI?

1 commentaire:

  1. PHPUnit 5.7.27 has a forwards-compatibility layer in it to allow using the PHPUnit namespace on PHP 5.6.

    Do you really need to test PHP 5.5? I've some clients using old PHP versions but no-one on anything earlier than 5.6.

    RépondreSupprimer