<p>You need to write some unit tests and set the <code>script</code> variable in your <code>.travis.yml</code> to actually run a file.</p>

<p>By default, Travis CI runs the command <code>phpunit</code> without any arguments. When this happens, <code>phpunit</code> doesn't know what you're asking it to do, and shows a help message, then exits with error code 2 (i.e. <strong>non-zero</strong>, which indicates an error occurred).</p>

<p>The <a href="https://docs.travis-ci.com/user/for-beginners" rel="noreferrer">Beginner's Guide</a> shows you a possible solution of setting the <code>script</code> variable to run a <code>Test.php</code> file with your tests in (insert this into your <code>.travis.yml</code>):</p>

<pre><code>script: phpunit Test.php
</code></pre>

<p>There is an example of a valid <code>Test.php</code> in the <a href="https://github.com/plaindocs/travis-broken-example/blob/master/Test.php" rel="noreferrer">example repo</a> that Travis provides:</p>

<pre><code>&lt;?php
    class Test extends PHPUnit_Framework_TestCase
    {
        public function testOnePlusOne() {
            $this-&gt;assertEquals(1+1,1);
        }
    }
?&gt;
</code></pre>

CC BY-SA 3.0
2017-03-03T11:20:59.370Z
2017-03-03T11:20:59.370Z
Aurora0001
<p>I am trying to integrate my project coded in core <strong>PHP</strong>, with <strong>Travis-CI</strong> but it always fails.</p>
<p>Travis reports a failure even when I have only one file in my project.</p>
<h2>PHP file Code :</h2>
<pre><code>&lt;?php

phpinfo();

?&gt;
</code></pre>
<hr />
<h2><code>.travis.yml</code> File Code</h2>
<pre><code>language: php
php:
  - '5.4'
  - '5.5'
  - '5.6'
  - '7.0'
  - '7.1'
  - hhvm
  - nightly
</code></pre>

CC BY-SA 3.0
2017-03-03T14:49:09.203Z
The link to the build report is broken...
7ochem
CC BY-SA 3.0
2017-03-03T16:11:29.443Z
As is, it sounds better suited for software engineering. It is not really related to a devopsy, to one of many tools used but not with a particular target on a devops subject.
Tensibai
CC BY-SA 3.0
2017-03-06T02:53:32.020Z
This seems to be on topic to me, as Continuous Integration (CI) is quite important to DevOps.
wogsland
<continuous-integration><travis-ci><php>
Problem in integrating Travis-CI with core PHP projects
Lovepreet Singh
# Problem in integrating Travis-CI with core PHP projects

(Asked by: username_0 on 2017-03-03)

I am trying to integrate my project coded in core PHP, with Travis-CI but it always fails.
Travis reports a failure even when I have only one file in my project.
PHP file Code :



.travis.yml File Code
language: php
php:
  - '5.4'
  - '5.5'
  - '5.6'
  - '7.0'
  - '7.1'
  - hhvm
  - nightly

**Tags:** continuous-integration, travis-ci, php

> **Comments:**
> **username_1**: The link to the build report is broken...  
> **username_2**: As is, it sounds better suited for software engineering. It is not really related to a devopsy, to one of many tools used but not with a particular target on a devops subject.  
> **username_3**: This seems to be on topic to me, as Continuous Integration (CI) is quite important to DevOps.  

---

## 1 answers

### Answer by username_4 on 2017-03-03. Score: 10 | Accepted answer

You need to write some unit tests and set the script variable in your .travis.yml to actually run a file.
By default, Travis CI runs the command phpunit without any arguments. When this happens, phpunit doesn't know what you're asking it to do, and shows a help message, then exits with error code 2 (i.e. non-zero, which indicates an error occurred).
The Beginner's Guide shows you a possible solution of setting the script variable to run a Test.php file with your tests in (insert this into your .travis.yml):
script: phpunit Test.php

There is an example of a valid Test.php in the example repo that Travis provides:
assertEquals(1+1,1);
        }
    }
?>


---

