Problem/Motivation

#2325197: Remove drupal_classloader() changed how the class loader works in DrupalKernel. This also needs to be done to TestKernel

Proposed resolution

Replicate the changes to DrupalKernel in TestKernel.

Remaining tasks

User interface changes

None.

API changes

None, though the type signature of TestKernel will remove the type hint for the $class_loader parameter.

Original report by @username

There is a type mismatch TestKernel and DrupalKernel for the createFromRequest method.

DrupalKernel:

public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE) { ... }

TestKernel:

public static function createFromRequest(Request $request, ClassLoader $class_loader, $environment, $allow_dumping = TRUE) { ... }

This causes problems when running some tests under PHP 5.5. For example, SimpleTestBrowserTest fails with PHP 5.5 IN HEAD. It passes when you add the proper type hint to DrupalKernel::createFromRequest().

Comments

mpdonadio’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: +WSCCI
StatusFileSize
new702 bytes

Patch with type hint added to DrupalKernel::createFromRequest()

mpdonadio’s picture

Title: Fix type signature mismatch between TestKernel and DrupalKernel » Update TestKernel to match class loader changes in Drupal Kernel
Assigned: Unassigned » mpdonadio
Issue summary: View changes
Status: Needs review » Needs work

Saw the related issue after I attached the patch. I'll take care of this.

mpdonadio’s picture

Status: Needs work » Needs review
StatusFileSize
new662 bytes

Since TestKernel just has one method that essentially just wraps DrupalKernel::createFromRequest(), I don't see what else needs to be done here. All tests with Kernel in the name and SimpleTestBrowserTest pass locally for me in PHP 5.5.

znerol’s picture

#3 is correct. Please also remove the use statement on line 12.

use Composer\Autoload\ClassLoader;
mpdonadio’s picture

StatusFileSize
new849 bytes
new375 bytes

Double checked all of the Kernel tests and SimpleTestBrowserTest locally.

znerol’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix

Thank you.

tstoeckler’s picture

Awesome, thanks!

Adding related issue.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per #2350615: [policy, no patch] What changes can be accepted during the Drupal 8 beta phase?. Committed d3b5655 and pushed to 8.0.x. Thanks!

  • alexpott committed d3b5655 on
    Issue #2367557 by mpdonadio: Fixed Update TestKernel to match class...

Status: Fixed » Closed (fixed)

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

mpdonadio’s picture

Assigned: mpdonadio » Unassigned

Cleaning up the issues that I am assigned to...