Challenge
- Given
- the drupalRenderPage() helper class method from the patch in http://drupal.org/node/1279226#comment-5949082
- the knowledge that a DrupalWebTestCase installs an entirely new Drupal site for every single
test*method in a test case
- When looking at
CommonJavaScriptTestCaseand realizing that none of the gazillion test methods needs a completely fresh Drupal site. - Then
- refactor the test methods in
CommonJavaScriptTestCaseso there is only one test method (but retaining the test method comments as inline comments) - merge the new
CommonJavaScriptDefaultsTestCasetest case into the former (if it exists already) - get the patch committed to Drupal 8
- backport the patch to Drupal 7.
- refactor the test methods in
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1558706_1_js_tests.patch | 11.28 KB | cosmicdreams |
Comments
Comment #1
cosmicdreams commentedAwesome description sun. and it sounds fun. I'll try to do this one tonight.
Comment #2
cosmicdreams commentedhalf-way done. Seeing how the tests respond
Comment #4
sunThis restore of config can be entirely removed.
Each new test needs to start with a reset, so previous drupal_add_js() calls do not interfere with new ones.
It would be a good idea to add a custom resetJS() method to this test, which performs the reset, so it can possibly be easily adjusted in one place later.
Comment #5
sunI'm sorry to do this, but in the meantime, #1411074: Add a flag to set up test environment only once per test class; introduce setUpBeforeClass() and tearDownAfterClass() [PHPUnit] is the actual and real solution, which makes this issue obsolete and kinda approaches the problem from the opposite direction.
CommonJavaScriptTestCase was already fixed in there.
Regardless of that, thanks for jumping on this issue and trying to resolve it! :)