Problem/Motivation

Seems there is a problem with addTranslation() method in mocked entity stubs.

Steps to reproduce

    $block1Values = [
      'type' => 'my_blocktype',
    ];
    $block1 = $this->entityStubFactory->create(BlockContent::class, $block1Values);
    $block1->addTranslation('en', $block1Values);
    $block1->save()

Is showing the error:

Error: Call to a member function getValue() on null

/var/www/html/docroot/core/lib/Drupal/Core/Field/FieldItemList.php:50

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

Murz created an issue. See original summary.

  • Murz committed 03ed87b on 1.0.x
    Issue #3311368 by Murz: Call to a member function getValue() on null...
murz’s picture

Title: Call to a member function getValue() on null when calling the addTranslation() method on EntityStub » 3311368-addTranslation
Status: Active » Fixed

I've implemented a rework of some mocks, that fixes this problem. Merged.

murz’s picture

Status: Fixed » Closed (fixed)
murz’s picture

Title: 3311368-addTranslation » Call to a member function getValue() on null when calling the addTranslation() method on EntityStub