Discovered as part of #697760: Replace getInfo() in tests with native phpDoc + annotations (following PHPUnit)

run-test.sh

  1. boots a temporary testing kernel ($allow_dumping = FALSE) in order to not load code of a possibly installed site.
  2. rebuilds that kernel (updateModules()) in order to add + load system.module + simpletest.module only.

That process involves lots of needless YAML processing + ExtensionDiscovery.

→ Introduce a TestKernel that has System + Simpletest module hard-coded right from the start.


Before:

$ run-tests.sh --class Drupal\system\Tests\File\HtaccessUnitTest
BOOT TIME: 3.84 sec


Drupal test run
---------------

Tests to be run:
  - Drupal\system\Tests\File\HtaccessUnitTest

Test run started:
  Saturday, May 3, 2014 - 01:04

Test summary
------------

BOOT TIME: 3.82 sec

Drupal\system\Tests\File\HtaccessUnitTest                     29 passes

Test run duration: 5 sec

After:

$ run-tests.sh --class Drupal\system\Tests\File\HtaccessUnitTest
BOOT TIME: 1.21 sec


Drupal test run
---------------

Tests to be run:
  - Drupal\system\Tests\File\HtaccessUnitTest

Test run started:
  Saturday, May 3, 2014 - 01:08

Test summary
------------

BOOT TIME: 1.19 sec

Drupal\system\Tests\File\HtaccessUnitTest                     29 passes

Test run duration: 2 sec

Remaining Tasks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Needs review
FileSize
3.24 KB
sun’s picture

FileSize
3.59 KB
806 bytes

Restored InstallerServiceProvider for --sqlite/--dburl support.

The last submitted patch, 1: test.kernel.1.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 2: test.kernel.2.patch, failed testing.

sun’s picture

2: test.kernel.2.patch queued for re-testing.

sun’s picture

Status: Needs work » Needs review

Testbot fluke (out of disk space)

sun’s picture

Title: run-tests.sh builds + rebuilds two kernels from scratch in every process » run-tests.sh builds + rebuilds two kernels from scratch for every PHP process
Issue summary: View changes
sun’s picture

Issue summary: View changes
damiankloip’s picture

Status: Needs review » Needs work

This makes a lot of sense, I like it :)

  1. +++ b/core/lib/Drupal/Core/Test/TestKernel.php
    @@ -0,0 +1,55 @@
    +    $this->environment = 'test-runner';
    +    $this->booted = FALSE;
    +    $this->classLoader = $class_loader;
    +    $this->allowDumping = FALSE;
    

    Parameters can just be passed to the parent instead. Booted will also be set to false there too.

  2. +++ b/core/lib/Drupal/Core/Test/TestKernel.php
    @@ -0,0 +1,55 @@
    +    $this->serviceProviderClasses[] = 'Drupal\Core\Installer\InstallerServiceProvider';
    

    In another issue, we should give this service provider a more accurate name.

sun’s picture

Status: Needs work » Needs review
FileSize
3.73 KB
1.36 KB

Call parent constructor; added some docs.

Status: Needs review » Needs work

The last submitted patch, 10: test.kernel.10.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
3.73 KB

Merged HEAD

sun’s picture

12: test.kernel.12.patch queued for re-testing.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

numbers look great:)

YesCT’s picture

Issue summary: View changes
Issue tags: +Novice, +Needs followup

adding Novice task to create separate issue asked for in #9

damiankloip’s picture

So not sure why we are tagging this issue as novice :)

+1 on the patch, the changes from my last review look great.

YesCT’s picture

Issue summary: View changes

@damiankloip The issue wasn't novice, the task to crate the follow-up was.

damiankloip’s picture

Yes, I get that. I don't understand why that makes this issue need the novice tag. Just create the follow up, tag it novice, and be done with it :)

sun’s picture

Created follow-up issue for the @todo that is being moved from one spot to another in this patch:

#2260007: Make Dupal\Core\Datetime\Date's dependency on the 'date_format' entity optional

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Great catch!

Committed and pushed to 8.x. Thanks!

  • Commit 39d126b on 8.x by webchick:
    Issue #2257427 by sun: Run-tests.sh builds + rebuilds two kernels from...

Status: Fixed » Closed (fixed)

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