Problem/Motivation

The method should not hardcode defaults, that dates back to when nodes were dumb objects, now Node::create() takes care of all the default values you need.

Specific example is that it still defaults langcode to undefined/und, while the field level default is now the site default language (en).

Proposed resolution

Remove all except those that set random values where there is no default (title/body)

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
FileSize
2.73 KB

Atleast some node access language tests are failing , let's see what else.

Status: Needs review » Needs work

The last submitted patch, 1: drupal-create-node-2333731-1.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
23.19 KB
20.46 KB

Fixing those tests. Most are because they assumed that the default langcode is und, not en. Some others because the default value for promote is true, not false.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Some of the tests in NodeAccessLanguageTest are now kinda stupid, but we check the created node also for specific langcodes like 'hu'
in there, so no problem here.

There is no change record for #1966436: Default *content* entity languages are not set for entities created with the API so we especially don't really need one here.

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-content, +sprint

This looks **amazing**. Covers the test changes we did not want to include in #1966436: Default *content* entity languages are not set for entities created with the API perfectly. :)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Nice :) Committed 537cc87 and pushed to 8.0.x. Thanks!

  • alexpott committed 537cc87 on 8.0.x
    Issue #2333731 by Berdir: Fixed WebTestBase::drupalCreateNode() should...
Gábor Hojtsy’s picture

Issue tags: -sprint

This is so great. Thanks a lot!

Status: Fixed » Closed (fixed)

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