Answers.Body: <p>I run tests the following way</p>
  
  <ol>
  <li>I test in a CiviCRM instance that is generated with buildkit (the toolchain provided for CiviCRM developers see <a href="https://docs.civicrm.org/dev/en/latest/tools/buildkit/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/tools/buildkit/</a> .</li>
  <li>My tests are generated with <code>civix generate:test</code>. Remarks that this generator also creates the file <code>tests/phpunit/bootstrap.php</code> that takes care of the class loading.</li>
  <li>I run the test from the extension directory by executing <code>phpunit4</code> (This version is installed with buildkit).</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-06T15:34:32.723Z
Answers.Text: This worked fine although when I use ``phpunit`` instead of ``phpunit4`` I still get the error ``Fatal error: Class 'PHPUnit_Framework_BaseTestListener' not found in ...``
Answers.UserDisplayName: Fanan Dala
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-03T15:01:20.833Z
Answers.LastActivityDate: 2018-03-03T15:01:20.833Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>This sounds like a mismatch in the phpunit versions:</p>
  
  <ul>
  <li>Currently, most of the Civi testing runs against the PHAR build of <code>phpunit</code> v4. </li>
  <li><code>phpunit</code> v6 <a href="https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-6.0.0" rel="nofollow noreferrer">renames every class</a> to use <code>\</code> instead of <code>_</code>, which means that all the base-classes disappear if you run on a newer build of phpunit.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-07T10:20:18.073Z
Answers.Text: Thanks Tim, this gives a good motivation why phpunit4 is used.
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-06T20:08:20.713Z
Answers.LastActivityDate: 2018-03-06T20:08:20.713Z
Answers.UserDisplayName: Tim Otten
Body: <p>I am trying to run a PHPunit test for my extension but I keep getting the following error:<br>
  <code>Fatal error: Class 'PHPUnit_Framework_BaseTestListener' not found in C:\xampp\htdocs\myDrupalsite\sites\all\modules\civicrm\Civi\Test\CiviTestListener.php on line 17</code><br>
  Any ideas on how I can fix this?<br>
  I am using CiviCRM 4.7<br>
  CMS is Drupal 7<br>
  My system OS is Windows 10. 
  My extension is placed in <code>&lt;Drupal root&gt;sites/default/files/civicrm/ext</code><br>
  My test directory was created using <code>civix generate:test</code> on the Windows command prompt.<br>
  I run the tests using PHPUnit via the command prompt in the root directory of my extension. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-03T14:54:59.287Z
Comments.Text: Hi Fanan, welcome to CiviCRM Stack Exchange. It helps if you add more detail to your question. Standard is the used CiviCRM version and the accompanying CMS. For this question, you can add how you run the test and more details about your development environment.
Comments.UserDisplayName: Kainuk - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-07T10:22:08.683Z
Comments.Text: Hi Fanan, impressive that you have it running on Windows.
Comments.UserDisplayName: Kainuk - CiviCooP
Tags: <drupal><phpunit>
Title: PHPUnit_Framework_BaseTestListener class not found
ThreadText: # PHPUnit_Framework_BaseTestListener class not found
  
  (Asked by: username_0 on 2018-03-03)
  
  I am trying to run a PHPunit test for my extension but I keep getting the following error:  
  `Fatal error: Class 'PHPUnit_Framework_BaseTestListener' not found in C:\xampp\htdocs\myDrupalsite\sites\all\modules\civicrm\Civi\Test\CiviTestListener.php on line 17`  
  Any ideas on how I can fix this?  
  I am using CiviCRM 4.7  
  CMS is Drupal 7  
  My system OS is Windows 10.
  My extension is placed in `<Drupal root>sites/default/files/civicrm/ext`  
  My test directory was created using `civix generate:test` on the Windows command prompt.  
  I run the tests using PHPUnit via the command prompt in the root directory of my extension.
  
  **Tags:** drupal, phpunit
  
  > **Comments:**
  > **username_1**: Hi username_0, welcome to CiviCRM Stack Exchange. It helps if you add more detail to your question. Standard is the used CiviCRM version and the accompanying CMS. For this question, you can add how you run the test and more details about your development environment.  
  > **username_1**: Hi username_0, impressive that you have it running on Windows.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-03-03. Score: 1 | Accepted answer
  
  I run tests the following way
  
  1. I test in a CiviCRM instance that is generated with buildkit (the toolchain provided for CiviCRM developers see <https://docs.civicrm.org/dev/en/latest/tools/buildkit/> .
  2. My tests are generated with `civix generate:test`. Remarks that this generator also creates the file `tests/phpunit/bootstrap.php` that takes care of the class loading.
  3. I run the test from the extension directory by executing `phpunit4` (This version is installed with buildkit).
  
  > **Comments:**
  > **username_0**: This worked fine although when I use ``phpunit`` instead of ``phpunit4`` I still get the error ``Fatal error: Class 'PHPUnit_Framework_BaseTestListener' not found in ...``  
  
  ---
  
  ### Answer by username_2 on 2018-03-06. Score: 1
  
  This sounds like a mismatch in the phpunit versions:
  
  * Currently, most of the Civi testing runs against the PHAR build of `phpunit` v4.
  * `phpunit` v6 [renames every class](https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-6.0.0) to use `\` instead of `_`, which means that all the base-classes disappear if you run on a newer build of phpunit.
  
  > **Comments:**
  > **username_1**: Thanks Tim, this gives a good motivation why phpunit4 is used.  
  
  ---
  
  