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:
- Mark duplicate on an issue to remove ajax_render()
- Rename this to "Missing test coverage in AjaxController" (or similar...)
Remaining tasks
Everything
Related Issues
#1998696: Use Symfony Request for core includes
#1959574: Remove the deprecated Drupal 7 Ajax API
Comments
Comment #0.0
tstoecklerAdded #1959574: Remove the deprecated Drupal 7 Ajax API to list of related issues and added comment about it.
Comment #0.1
tstoecklerIn fact providing test coverage when there's a critical to remove the tested code makes little sense.
Comment #1
Crell CreditAttribution: Crell commentedTagging.
Comment #1.0
Crell CreditAttribution: Crell commentedIssue in related issues got lost
Comment #2
Crell CreditAttribution: Crell at Palantir.net commentedThe code has changed too much for this issue to still be relevant.