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?
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | interdiff-2468907-11-16.txt | 2.33 KB | miroslavbanov |
| #16 | refactor-drafty-tests-2468907-16.patch | 51.56 KB | miroslavbanov |
| #13 | interdiff-2468907-11-13.txt | 1019 bytes | tessa bakker |
| #13 | refactor-drafty-tests-2468907-13.patch | 50.95 KB | tessa bakker |
Comments
Comment #1
agentrickardComment #2
miroslavbanov commentedI also experienced same issue. I use i18n, and rarely have entity translation installed.
Comment #3
tessa bakkerThis is a first start to split up the test classes and make them load, even without the module Entity Translation.
Comment #5
miroslavbanov commentedIt 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.
Comment #6
tessa bakkerIf it's easier to split up first the classes and than make the changes, I wouldn't mind to create a new patch/issue.
Comment #7
tessa bakkerMy mistake :(
Comment #8
partdigital commentedI'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
Comment #9
alejcerro commentedI'm having this issue as well. I can't run any tests through the admin GUI as it returns a
500error when I navigate toadmin/config/development/testing.Comment #10
tessa bakkerWill try to fix the test/update the patch this weekend.
Comment #11
tessa bakkerAdded the missing 'administer fields' permission.
Comment #12
miroslavbanov commentedThis 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 6With 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:
These run successfully:
These fail with fatal errors for missing functions:
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.
Comment #13
tessa bakkerHi MiroslavBanov,
Thanks for reviewing my patch, here is a new version that should fix the dependency issues with Title and Field Collection.
Comment #14
tessa bakkerComment #16
miroslavbanov commented#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.
Comment #17
tessa bakkerNice 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)
Comment #18
damienmckennaThis is also causing Panelizer's tests to fail (https://dispatcher.drupalci.org/job/drupal_d7/1748/console).
Bump! (thanks)
Comment #19
damienmckennaI don't been to be a bear, but I'm bumping this again as it's causing tests for other modules to fail.
Comment #20
fabianx commentedRTBC + 1, pinged catch, too.
Comment #22
damienmckennaCommitted! Thanks all.