Problem/Motivation

HandlerAllTest makes no HTTP requests but is a functional test.

Proposed resolution

Convert HandlerAllTest into a kernel test.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

CommentFileSizeAuthor
#2 3041755-2.patch3.6 KBclaudiu.cristea

Issue fork drupal-3041755

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Status: Active » Needs review
StatusFileSize
new3.6 KB

This patch decreased the test time, locally, from 20 to 4 seconds.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This is not quite testing the same things. If I do var_dump(count($this->container->get('views.views_data')->get())); in the functional test I get This test printed output: int(49) and if I do in the kernel test i get This test printed output: int(37).

lendude’s picture

Looking at the history of this test in #1777194: One handler test to rule them all it seems the idea behind it was to test all the handlers in core, so it enabled all the modules that had views handlers and tested them.

+++ b/core/modules/views/tests/src/Kernel/Handler/HandlerAllTest.php
@@ -14,32 +17,24 @@
-    'block',
...
-    'contact',
...
-    'filter',
...
-    'history',
-    'language',
-    'locale',
...
-    'search',
-    'statistics',

So instead of removing these modules, we should be adding more modules, that have been added to core in the time since the original issue, that contain views handlers

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Hardik_Patel_12 made their first commit to this issue’s fork.

spokje’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

1 nitpicky item. But how we have done other conversions think it should be included.

spokje’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @Spokje

longwave’s picture

Status: Reviewed & tested by the community » Needs work

I repeated #4 and there is still a difference (but also see how much quicker the kernel test is):

Time: 00:11.982, Memory: 4.00 MB

There was 1 error:

1) Drupal\Tests\views\Functional\Handler\HandlerAllTest::testHandlers
This test printed output: int(35)

vs

Time: 00:02.926, Memory: 4.00 MB

There was 1 error:

1) Drupal\Tests\views\Kernel\Handler\HandlerAllTest::testHandlers
This test printed output: int(31)

Maybe we need some additional coverage to ensure all handlers in core are included?

lendude’s picture

Status: Needs work » Needs review

Added some more modules

This test printed output: int(37)

Checked all modules that implement hook_views_data, think this get all of the ones that don't need extra handling or just reuse existing plugins...I think

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback appears to be addressed.

spokje’s picture

Do we need either a follow-up or some more work in here to make sure that adding modules with views handlers to core, but not to this test. would break either this test or another new test?

catch’s picture

I think a follow-up to add a test coverage test is probably a good idea, the old test would not have caught new modules either so not a requirement for me, but useful to have.

  • catch committed b604d68a on 10.2.x
    Issue #3041755 by Hardik_Patel_12, claudiu.cristea, Lendude, Spokje,...

  • catch committed eb2baa20 on 11.x
    Issue #3041755 by Hardik_Patel_12, claudiu.cristea, Lendude, Spokje,...
catch’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 10.2.x, thanks!

Status: Fixed » Closed (fixed)

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