Comments

dasjo’s picture

dasjo’s picture

Priority: Critical » Normal
fubhy’s picture

Assigned: Unassigned » fubhy
klausi’s picture

Status: Active » Fixed

Done by fubhy, thanks!

fubhy’s picture

Assigned: fubhy » Unassigned
Torenware’s picture

A general question about doing this.

As we're implementing PHPUnit into Drupal 8, unit tests do not actually bootstrap Drupal itself; any part of Drupal that a unit test may need to refer to a working Drupal framework [should be mocked https://drupal.org/node/2012184]:

The testing framework PHPUnit has been added to Drupal 8. Simpletest is still supported but should only be used for web tests and DrupalUnitTest's that require a complete or partial Drupal environment. At the moment, only unit tests can be written with PHPUnit.

This is not a limitation of PHPUnit, per se: it's possible to have PHPUnit bootstrap Drupal before running tests. So it's a limitation of how we _use_ PHPUnit instead.

My main concern here is that Rules for D8 is a "system integrating" module. Our conditions test things that are implemented by Core. So a unit test that works perfectly well with mocks may be passing a condition or action plugin that will not actually work when we use that condition or action in a current build of Drupal 8.

This strikes me as strange, and probably undesirable.

We really do need to test system integration. So either:

  • We need to keep some of our SimpleTest based tests for this purpose, or
  • We need to have some PHPUnit tests that know how to bootstrap Drupal.

I personally favor the latter approach (this is how I use PHPUnit in Drupal 7), since I think PHPUnit is a richer and better maintained framework. But that would require some extra work. Using SimpleTest would at least make sure we know if changes in Core are breaking our code.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.