# PHP 7.3: pre-install PHPUnit version 9.0 is broken

**URL:** <https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187>\
**Category:** PHP\
**Created:** [April 17, 2020, 6:29am UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187 "2020-04-17T06:29:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![andig](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/andig/32/3805_2.png) [@andig](https://travis-ci.community/u/andig)\
**Post date:** [April 17, 2020, 6:29am UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/1 "2020-04-17T06:29:36Z")

</div>

Running a php 7.3 build, pre-installed PHPUnit 9 fails:

```
$ phpunit
PHPUnit 9.0.1 by Sebastian Bergmann and contributors.
Cannot open file "/home/travis/build/[secure]/carddav2fb/vendor/autoload.php".
The command "phpunit" exited with 1.

```

This happens due to the PHPUnit step executed before the repo is cloned. It seems that PHPUnit 9.1does not have this behaviour.

---

<div class="post-metadata">

**Author:** ![andig](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/andig/32/3805_2.png) [@andig](https://travis-ci.community/u/andig)\
**Post date:** [June 10, 2020, 10:55am UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/2 "2020-06-10T10:55:00Z")

</div>

This is still a problem. The PHP 7.3 version is unusable for me:

```
$ phpenv global 7.3
$ composer self-update
Updating to version 1.10.7 (stable channel).
Downloading (connecting...)Downloading (100%)
Use composer self-update --rollback to return to version 1.10.6
Setting up build cache

$ php --version
PHP 7.3.18 (cli) (built: May 15 2020 06:05:01) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.9.5, Copyright (c) 2002-2020, by Derick Rethans
$ composer --version
Composer version 1.10.7 2020-06-03 10:03:56

$ phpunit
PHPUnit 9.1.4 by Sebastian Bergmann and contributors.

Cannot open file "/home/travis/build/[secure]/carddav2fb/vendor/autoload.php".
```

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 10, 2020, 12:32pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/3 "2020-06-10T12:32:18Z")

</div>

When reporting problems, please consider including:

1. What you are trying to achieve
2. What you have tried (probably a link to the configuration)
3. What happened instead (often, pointing to a build log URL, in the form of [https://travis-ci.com/OWNER/REPO/build/NNNNNNN](https://travis-ci.com/OWNER/REPO/build/NNNNNNN) would be helpful).

---

<div class="post-metadata">

**Author:** ![andig](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/andig/32/3805_2.png) [@andig](https://travis-ci.community/u/andig)\
**Post date:** [June 10, 2020, 12:48pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/4 "2020-06-10T12:48:56Z")

</div>

I’m trying to run a php 7.3 build, here is an example: [https://travis-ci.org/github/andig/carddav2fb/builds/696800149](https://travis-ci.org/github/andig/carddav2fb/builds/696800149).

The configuration is in [https://github.com/andig/carddav2fb/blob/master/.travis.yml](https://github.com/andig/carddav2fb/blob/master/.travis.yml).

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 10, 2020, 1:24pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/5 "2020-06-10T13:24:36Z")

</div>

Why is this file getting loaded? And does it exist?

A simple invocation of `phpunit` does not exhibit this behavior [https://travis-ci.org/github/BanzaiMan/travis\_production\_test/builds/696826619#L449](https://travis-ci.org/github/BanzaiMan/travis_production_test/builds/696826619#L449)

As an aside, I mention that

> <https://github.com/andig/carddav2fb/blob/36f5a8d8e980176f9fb00a650954f7c212906a64/.travis.yml>

  
defines both `matrix` and `jobs`, so `jobs` is ignored. See the config validation message in [https://travis-ci.org/github/andig/carddav2fb/jobs/696800150/config](https://travis-ci.org/github/andig/carddav2fb/jobs/696800150/config)

---

<div class="post-metadata">

**Author:** ![andig](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/andig/32/3805_2.png) [@andig](https://travis-ci.community/u/andig)\
**Post date:** [June 10, 2020, 1:53pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/6 "2020-06-10T13:53:24Z")

</div>

> [@BanzaiMan](#):
>
> Why is this file getting loaded? And does it exist?

The file does not exist because it will only exist after composer install has run. I wrote:

> This happens due to the PHPUnit step executed before the repo is cloned. It seems that PHPUnit 9.1does not have this behaviour.

I was wrong about repo being cloned, the relevant step is `composer install`.

The main point here is that- independent from matrix vs jobs (which I’ll double-check) that invoking `phpunit` before composer is broken when phpunit 9.0 is used. As this is happening before using script in travis is run, it’s out of user’s control.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 10, 2020, 2:13pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/7 "2020-06-10T14:13:30Z")

</div>

> **[Travis CI Documentation](https://docs.travis-ci.com/user/languages/php)**
>
> Building a PHP project

In PHP, there is no default `install` step, so `composer install` should not be running. I don’t see the evidence it, either. If your repo is expecting to run `composer install` in the `install` phase, you’ll have to make sure that it is. (Because it is not, due to your error in `.travis.yml`.)

> <https://github.com/andig/carddav2fb/blob/0ec68d400d70efc902ae926690d3f522403997e7/.travis.yml#L26>

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 10, 2020, 2:22pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/8 "2020-06-10T14:22:55Z")

</div>

Looks like your fixing the build configuration fixed this issue.

[https://travis-ci.org/github/andig/carddav2fb/jobs/696865229](https://travis-ci.org/github/andig/carddav2fb/jobs/696865229)

---

<div class="post-metadata">

**Author:** ![andig](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/andig/32/3805_2.png) [@andig](https://travis-ci.community/u/andig)\
**Post date:** [June 10, 2020, 2:59pm UTC](https://travis-ci.community/t/php-7-3-pre-install-phpunit-version-9-0-is-broken/8187/9 "2020-06-10T14:59:35Z")

</div>

Indeed, thanks to your hint I was able to fix the config. This used to work before (which is what users are always saying, I know ;).  
I understand the install step is run before `phpunit version` is executed. I wasn‘t aware of the connection, thank you very much!
