DefaultTableMapping example

    $updated_entity_type = $this->createMock('Drupal\Core\Entity\ContentEntityTypeInterface');
    $updated_entity_type->expects($this->any())
      ->method('id')
      ->willReturn($this->entityTypeId);
    $updated_entity_type->expects($this->any())
      ->method('isRevisionable')
      ->willReturn(TRUE);
    $updated_entity_type->expects($this->any())
      ->method('isTranslatable')
      ->willReturn(TRUE);

    $table_mapping = new DefaultTableMapping($updated_entity_type[]);
    $this->entityStorage->setTableMapping($table_mapping);

    $this->assertSame('entity_test', $this->entityStorage->getBaseTable());
    $this->assertSame('entity_test_revision', $this->entityStorage->getRevisionTable());
    $this->assertSame('entity_test_field_data', $this->entityStorage->getDataTable());
    $this->assertSame('entity_test_field_revision', $this->entityStorage->getRevisionDataTable());
  }

  /** * Tests ContentEntityDatabaseStorage::onEntityTypeCreate(). * * @covers ::__construct * @covers ::onEntityTypeCreate * @covers ::getTableMapping */
Home | Imprint | This part of the site doesn't use cookies.