TestPerComponentEntityFormDisplay example


    $entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityFormDisplay')
      ->disableOriginalConstructor()
      ->getMock();
    $entity->expects($this->once())
      ->method('setComponent')
      ->with('field_name_test', ['test setting'])
      ->will($this->returnSelf());
    $entity->expects($this->once())
      ->method('save')
      ->with();
    $plugin = new TestPerComponentEntityFormDisplay($entity);
    $this->assertSame(['entity_type_test', 'bundle_test', 'form_mode_test', 'field_name_test']$plugin->import($row));
    $this->assertSame(['entity_type_test', 'bundle_test', 'form_mode_test']$plugin->getTestValues());
  }

}

class TestPerComponentEntityFormDisplay extends PerComponentEntityFormDisplay {
  const MODE_NAME = 'form_mode';
  protected $testValues;
  protected $entity;

  
Home | Imprint | This part of the site doesn't use cookies.