The current .info file declared test_dependencies which throw fatal errors on the Simpletest admin page if those modules are not installed. (Specifically, Entity Translation.)

We should not require people to download modules that they don't need just to run proper tests.

Can we refactor the test classes to be conditional?

Comments

agentrickard’s picture

Issue summary: View changes
miroslavbanov’s picture

I also experienced same issue. I use i18n, and rarely have entity translation installed.

tessa bakker’s picture

Status: Active » Needs review
StatusFileSize
new49.99 KB

This is a first start to split up the test classes and make them load, even without the module Entity Translation.

Status: Needs review » Needs work

The last submitted patch, 3: refactor-drafty-tests-2468907-3.patch, failed testing.

miroslavbanov’s picture

Priority: Normal » Major

It is very hard to diff this. Ended up comparing the files side by side. The patch splits the four classes into four files. Additionally two of the classes are renamed: DraftyTitleTranslationTestCase -> DraftyTitleTestCase; DraftyEtTest -> DraftyEntityTranslationTest.

Most of the code is exactly the same, just some tiny code formatting changes.

Again, this is hard to diff, so I recommend strict interdiffs for all changes from this patch on. It would be nice if other changes to the tests are not added until this one is committed, as they may be disruptive to the work here. Not sure what to do about this, but bumping priority for now.

About the test errors, they look to be some incompatibility with entity_translation module. Can't see how this issue would be a regression caused by this patch. Maybe it is changes to entity_translation module that introduced the regression here.

tessa bakker’s picture

Priority: Major » Normal

If it's easier to split up first the classes and than make the changes, I wouldn't mind to create a new patch/issue.

tessa bakker’s picture

Priority: Normal » Major

My mistake :(

partdigital’s picture

I've been experiencing issue with this as well with Workbench Scheduler. None of the automated tests on Drupal.org are passing now. Caused by this error:

13:44:27 PHP Fatal error: Class 'EntityTranslationTestCase' not found in /var/www/html/sites/all/modules/drafty/modules/drafty_1992010/drafty_1992010.test on line 6

alejcerro’s picture

I'm having this issue as well. I can't run any tests through the admin GUI as it returns a 500 error when I navigate to admin/config/development/testing.

tessa bakker’s picture

Assigned: Unassigned » tessa bakker

Will try to fix the test/update the patch this weekend.

tessa bakker’s picture

Status: Needs work » Needs review
StatusFileSize
new51.12 KB
new1.57 KB

Added the missing 'administer fields' permission.

miroslavbanov’s picture

Status: Needs review » Needs work

This is test only change. It fixes the failing tests and nicely separates them in files. Without the patch, I get fatal error when I try to access the "admin/config/development/testing" page:
Fatal error: Class 'EntityTranslationTestCase' not found in ...drafty/modules/drafty_1992010/drafty_1992010.test on line 6

With the patch I can actually run tests.

With no Title, Field collection, and no Translation modules present in the codebase, I see the following tests in the UI:

  • Drafty
  • Drafty Enforce
  • Drafty field collection
  • Drafty with title translation

These run successfully:

  • Drafty
  • Drafty Enforce

These fail with fatal errors for missing functions:

  • Drafty field collection - fixed by downloading field_collection.
  • Drafty with title translation - fixed by downloading title + entity_translation.

So things are a lot better now. I see no regressions, most issues are fixed, only two small ones remaining. The patch can be committed as partial fix, because currently the testbot is failing without it.

tessa bakker’s picture

StatusFileSize
new50.95 KB
new1019 bytes

Hi MiroslavBanov,

Thanks for reviewing my patch, here is a new version that should fix the dependency issues with Title and Field Collection.

tessa bakker’s picture

Status: Needs work » Needs review

The last submitted patch, 13: refactor-drafty-tests-2468907-13.patch, failed testing.

miroslavbanov’s picture

#13 is not going to work. setUp method returns FALSE or NULL, but even if you make it work with some tweak it just seems wrong.

I did some research, and apparently you define dependency on other modules in getInfo method. See for example how feeds creates a test for the rules integration:
http://cgit.drupalcode.org/feeds/tree/tests/feeds_rules.test#n13

I created a patch, and it appears to work. The tests don't show at all if the modules are missing from the codebase.

tessa bakker’s picture

Assigned: tessa bakker » Unassigned
Priority: Major » Critical
Status: Needs review » Reviewed & tested by the community

Nice fix MiroslavBanov!

Let's commit this, currently the tests of workbench_moderation are failing without this patch: https://dispatcher.drupalci.org/job/drupal_d7/1219/console (see bottom of log)

damienmckenna’s picture

This is also causing Panelizer's tests to fail (https://dispatcher.drupalci.org/job/drupal_d7/1748/console).

Bump! (thanks)

damienmckenna’s picture

I don't been to be a bear, but I'm bumping this again as it's causing tests for other modules to fail.

fabianx’s picture

RTBC + 1, pinged catch, too.

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed
Parent issue: » #2853660: Plan for Drafty 7.x-1.0-beta4 release

Committed! Thanks all.

Status: Fixed » Closed (fixed)

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