The DrupalKernel in DrupalUnitTestBase should not be dumped.

CommentFileSizeAuthor
#7 drupal8.dutb-kernel.7.patch773 bytessun
drupal8.dutb-kernel.0.patch719 bytessun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

katbailey’s picture

Status: Needs review » Reviewed & tested by the community

Word.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Since I have no idea what in the heck "dumping" means, and still don't after having trawled through DrupalKernel.php (I guess it takes the contents of the container and writes it out to disk. Why..?), could we get a one-liner comment that helps the next person understand why FALSE is passed here, since the details in this issue certainly won't help them discern this. :D

sun’s picture

Status: Needs work » Reviewed & tested by the community

Sorry, but I think this is the wrong issue/place to discuss or document that.

DrupalUnitTestBase only uses this API, and this patch only adjusts the API call. The additional FALSE flag is passed to prevent the kernel from compiling and dumping its container when executing a DrupalUnitTest. That is unnecessary, since the entire test is executed in memory, which means that the dumped kernel/container will not be read again later on.

@chx created #1850438: Establish DrupalKernel argument good practices for similar reasons, the $allowDumping argument could be documented + patched in there, too.

If that issue not sufficient (possible), then I'd suggest to create a dedicated issue along the lines of "What the heck is a DrupalKernel, where is it, what does it do, what are all of those arguments, what means compiling, and what the heck means dumping?" ;-)

webchick’s picture

Status: Reviewed & tested by the community » Needs review

No, what we need then is basically this:

     // Bootstrap the kernel.
     // Dumping is unnecessary, since the entire test is executed in memory, so  the dumped kernel/container will not be read again later on.
     +    $this->kernel = new DrupalKernel('testing', TRUE, drupal_classloader(), FALSE);

(give or take an 80 character wrap)

If that's the proper comment I can just fix it on commit, but I've literally no idea because the documentation in DrupalKernel around this is so poor (which, yes, has nothing to do with this issue).

sun’s picture

webchick’s picture

Oh, well that would also work. :)

sun’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
773 bytes

Added the comment. In a way it can be deleted with the other issue.

catch’s picture

Status: Reviewed & tested by the community » Fixed

That comment works for me, and the other issue makes sense too.

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