ConfigEntityType example

/** * {@inheritdoc} * * @covers ::__construct */
  protected function setUp(): void {
    parent::setUp();

    $this->entityTypeId = 'test_entity_type';

    $entity_type = new ConfigEntityType([
      'id' => $this->entityTypeId,
      'class' => get_class($this->getMockEntity()),
      'provider' => 'the_provider',
      'config_prefix' => 'the_config_prefix',
      'entity_keys' => [
        'id' => 'id',
        'uuid' => 'uuid',
        'langcode' => 'langcode',
      ],
      'config_export' => [
        'id',
      ],

  protected function setUpConfigEntityType($definition) {
    if (!isset($definition['id'])) {
      $definition += [
        'id' => 'example_config_entity_type',
      ];
    }
    return new ConfigEntityType($definition);
  }

  /** * Tests when the prefix length exceeds the maximum defined prefix length. * * Tests that we get an exception when the length of the config prefix that is * returned by getConfigPrefix() exceeds the maximum defined prefix length. * * @covers ::getConfigPrefix */
  public function testConfigPrefixLengthExceeds() {
    
'value' => 0,
          'numeric' => TRUE,
        ],
      ],
    ]$data['entity_test__string']['table']['join']['entity_test']);
  }

  /** * Tests fields on the data table. */
  public function testDataTableFields() {
    $entity_test_type = new ConfigEntityType([
      'class' => ConfigEntityBase::class,
      'id' => 'entity_test_bundle',
      'entity_keys' => [
        'id' => 'type',
        'label' => 'name',
      ],
    ]);
    $this->setUpEntityType($entity_test_type);

    $entity_type = $this->baseEntityType
      ->set('data_table', 'entity_test_mul_property_data')
      
Home | Imprint | This part of the site doesn't use cookies.