Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295769

Multilingual node tests should use the API rather than form submissions in setUp()

$
0
0

Problem/Motivation

Various functional tests in node module use form submission to perform setup. E.g., in NodeFieldMultilingualTest::setUp():

    // Enable URL language detection and selection.
    $edit = ['language_interface[enabled][language-url]' => '1'];
    $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));

    // Set "Basic page" content type to use multilingual support.
    $edit = [
      'language_configuration[language_alterable]' => TRUE,
    ];
    $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
    $this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']), 'Basic page content type has been updated.');

This makes the test slower, because form submissions in the test browser take longer than API calls.

Replacing this with API calls will make the test faster to run, and easier to read.

Proposed resolution

Replace with API calls.


Viewing all articles
Browse latest Browse all 295769

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>