Updated: Comment #0

Problem/Motivation

ajax_render() does not have test coverage for the following line:

    if (empty($_POST['ajax_page_state'][$type])) {

This was uncovered in #1998696: Use Symfony Request for core includes where the following hunk passed tests:

+++ b/core/includes/ajax.inc
@@ -235,12 +235,14 @@ function ajax_render($commands = array()) {
-    if (empty($_POST['ajax_page_state'][$type])) {
+    $state = $request->request->get('ajax_page_state[' . $type . ']', FALSE, TRUE);
+    if ($state) {

When looking closely, one sees that the new code should in fact be

    if (!$state) {

See also #52 to #56 over there.

Quoting Crell #58 over there:

Why is ajax_render() even still a thing? That should be gone entirely by now. If not, I'm sure there's an issue somewhere to remove it. If not, there should be. :-)

That issue is in fact #1959574: Remove the deprecated Drupal 7 Ajax API. It needs to be checked, however, that the equivalent code in the new Ajax code has proper test coverage.

Proposed resolution

One of the two:

  1. Mark duplicate on an issue to remove ajax_render()
  2. Rename this to "Missing test coverage in AjaxController" (or similar...)

Remaining tasks

Everything

#1998696: Use Symfony Request for core includes
#1959574: Remove the deprecated Drupal 7 Ajax API

Comments

tstoeckler’s picture

Issue summary: View changes

Added #1959574: Remove the deprecated Drupal 7 Ajax API to list of related issues and added comment about it.

tstoeckler’s picture

Issue summary: View changes

In fact providing test coverage when there's a critical to remove the tested code makes little sense.

Crell’s picture

Issue tags: +WSCCI

Tagging.

Crell’s picture

Issue summary: View changes

Issue in related issues got lost

Crell’s picture

Status: Active » Fixed

The code has changed too much for this issue to still be relevant.

Status: Fixed » Closed (fixed)

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