title: Using Jenkins for Yii Codeception tests
body: <p>I am trying to automate Yii 2 tests using Jenkins. Since the tests have been recently decentralized, I would like to see all tests run at once. For this, I have created a small shell script</p>
  <p><strong><em>test-all.sh</em></strong></p>
  <pre><code>#!/bin/bash
  which codecept
  for i in */tests
  do
      i=${i%tests}
      cd &quot;$i&quot;
      codecept run --fail-fast
      cd ../
  done
  </code></pre>
  <p>When this is run from the command-line (Git Bash), the tests run properly. However, when I run this file in Jenkins, although the build returns SUCCESSfully, no tests are being run.</p>
  <pre><code>[CI] $ &quot;C:\Program Files\Git\usr\bin\sh.exe&quot; -xe C:\Windows\TEMP\hudson8239762865441374376.sh
  + cd /c/xampp/htdocs/mtnt-2
  + /usr/bin/bash test-all.sh
  /c/xampp/htdocs/mtnt-2
  test-all.sh: line 3: which: command not found
  test-all.sh: line 8: codecept: command not found
  test-all.sh: line 8: codecept: command not found
  test-all.sh: line 8: codecept: command not found
  test-all.sh: line 8: codecept: command not found
  Finished: SUCCESS
  </code></pre>
  <p>It can't seem to find the <code>which</code> command and the <code>codecept</code> command which are both in my <code>PATH</code> variable.</p>
  <p>How do I fix this?</p>
  <h3>Updates</h3>
  <p>So far, I have attempted changing the path for the master node. That also didn't suffice. I confirmed through <code>Jenkins -&gt; Manage Jenkins -&gt; System Information</code> that the path to the global Composer vendor bin is included in the Path variable.</p>
  <p>I also tried having <code>codeception</code> locally in the project. The new test-all.sh script is thus</p>
  <pre><code>#!/bin/bash
  ROOT_FOLDER=`pwd`
  for i in */tests
  do
      i=${i%tests}
      cd &quot;`pwd`/$i&quot;
      $ROOT_FOLDER/vendor/bin/codecept run --fail-fast
      cd ../
  done
  </code></pre>
  <p>Now, I get the following error.</p>
  <pre><code>[CI] $ &quot;C:\Program Files\Git\usr\bin\bash.exe&quot; -xe C:\Windows\TEMP\hudson2613836971033972638.sh
  + cd /c/xampp/htdocs/mtnt-2/
  + ./test-all.sh
  /usr/bin/env: sh: No such file or directory
  /usr/bin/env: sh: No such file or directory
  /usr/bin/env: sh: No such file or directory
  /usr/bin/env: sh: No such file or directory
  Finished: SUCCESS
  </code></pre>