Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291167

Make CascadingStylesheetsTest 3500% faster

$
0
0

While working on #352951: Make JS & CSS Preprocessing Pluggable, I got very much fed up with the extreme slowness of CascadingStylesheetsTest.php.

Difference

  • Before: 281 seconds
  • After: 8 seconds
  • (That's 35.125 times faster, or only 2.85% of the original test running time.)

It used WebTestBase for historical reasons, while it could easily use DrupalUnitTestBase now.

Ideally, this would be a PHPUnit test, but that's not technically possible right now. This will at least make it a whole lot faster, while retaining the same test coverage.

Changes

I changed as little as possible:

  • DrupalWebTestBase -> DrupalUnitTestBase
  • Removed testRenderInlineFullPage() since it was rather pointless: it tests adding inline CSS, but that's already tested in two other tests, and in fact to do so it used the PHP filter of all things…
  • Instead of relying on a certain page callback in common_test module, which would indeed need WebTestBase, I just moved the relevant parts of common_test.module into the test itself (2 lines of code).

Viewing all articles
Browse latest Browse all 291167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>