Answers.Body: <p>My problem was solved by using the command <code>phpunit4</code> from inside the extension directory. Use <code>--group e2e</code> or <code>--group headless</code> as needed.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-15T01:00:38.037Z
Answers.LastActivityDate: 2017-03-15T01:00:38.037Z
Answers.UserDisplayName: JohnFF
Body: <p>When I run e2e unit tests, it doesn't seem to recognise that I'm telling it to only use group e2e. This is possibly due to the default include/exclude filters in the phunit.xml file.</p>
  
  <p>When I add the group e2e to the phunit.xml file, I get </p>
  
  <p>CRM_BedResourceManager_BedResourceManagere2eTest
  exception <code>RuntimeException</code> with message <code>\Civi\Test::e2e() requires a real CMS. Found CIVICRM_UF=UnitTests.</code></p>
  
  <p>When I hack the tools/scripts/phpunit to contain CIVICRM_UF='Drupal', not 'UnitTets' it then goes on to say </p>
  
  <p>packages/DB/DataObject.php: "No database name / dsn found anywhere",</p>
  
  <p>I tried popping some entries from civicrm_settings in there, but it didn't work.</p>
  
  <p>a) Does anyone have a working e2e unit test config?</p>
  
  <p>b) What are the settings I need to put in my tools/scripts/phpunit to make it work properly? My Civi and Drupes are in the same database.</p>
  
Tags: <unit-testing>
Title: Working e2e UnitTests?
ThreadText: # Working e2e UnitTests?
  
  (Asked by: username_0 on 2017-03-12)
  
  When I run e2e unit tests, it doesn't seem to recognise that I'm telling it to only use group e2e. This is possibly due to the default include/exclude filters in the phunit.xml file.
  
  When I add the group e2e to the phunit.xml file, I get
  
  CRM\_BedResourceManager\_BedResourceManagere2eTest
  exception `RuntimeException` with message `\Civi\Test::e2e() requires a real CMS. Found CIVICRM_UF=UnitTests.`
  
  When I hack the tools/scripts/phpunit to contain CIVICRM\_UF='Drupal', not 'UnitTets' it then goes on to say
  
  packages/DB/DataObject.php: "No database name / dsn found anywhere",
  
  I tried popping some entries from civicrm\_settings in there, but it didn't work.
  
  a) Does anyone have a working e2e unit test config?
  
  b) What are the settings I need to put in my tools/scripts/phpunit to make it work properly? My Civi and Drupes are in the same database.
  
  **Tags:** unit-testing
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-03-15. Score: 1
  
  My problem was solved by using the command `phpunit4` from inside the extension directory. Use `--group e2e` or `--group headless` as needed.
  
  
  ---
  
  