Run test in phpunit with specific php version

前端 未结 2 951
北荒
北荒 2021-01-12 04:10

I have installed multiple PHP versions on my Mac and want to run unit-tests against a specific PHP version (or against multipls versions)

Here\'s the php versions I

相关标签:
2条回答
  • 2021-01-12 04:32
    $ /Applications/MAMP/bin/php/php5.2.17/bin/php path/to/phpunit.phar
    

    Create a script e.g. phpunit-using-5.2

    #!/bin/sh
    set -e
    
    /Applications/MAMP/bin/php/php5.2.17/bin/php path/to/phpunit.phar "$@"
    

    Now you can run it:

    $ phpunit-using-5.2
    

    Or you can create a bash alias too.

    0 讨论(0)
  • 2021-01-12 04:45

    I had two version of php, default is 7.4 and older is 7.3, so I can test my testcase with older version like this.

    php7.3 ./vendor/bin/phpunit
    
    0 讨论(0)
提交回复
热议问题