You are here

public function SqlContentEntityStorageTest::testGetRevisionDataTable in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetRevisionDataTable()
  2. 10 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetRevisionDataTable()

Tests SqlContentEntityStorage::getRevisionDataTable().

@covers ::__construct @covers ::getRevisionDataTable

@dataProvider providerTestGetRevisionDataTable

Parameters

string $revision_data_table: The revision data table to be returned by the mocked entity type.

string $expected: The expected return value of SqlContentEntityStorage::getRevisionDataTable().

File

core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php, line 270
Contains \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest.

Class

SqlContentEntityStorageTest
@coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage @group Entity

Namespace

Drupal\Tests\Core\Entity\Sql

Code

public function testGetRevisionDataTable($revision_data_table, $expected) {
  $this->entityType
    ->expects($this
    ->any())
    ->method('isRevisionable')
    ->will($this
    ->returnValue(TRUE));
  $this->entityType
    ->expects($this
    ->any())
    ->method('isTranslatable')
    ->will($this
    ->returnValue(TRUE));
  $this->entityType
    ->expects($this
    ->exactly(1))
    ->method('getDataTable')
    ->will($this
    ->returnValue('entity_test_field_data'));
  $this->entityType
    ->expects($this
    ->once())
    ->method('getRevisionDataTable')
    ->will($this
    ->returnValue($revision_data_table));
  $this->entityType
    ->expects($this
    ->any())
    ->method('getRevisionMetadataKeys')
    ->willReturn([]);
  $this
    ->setUpEntityStorage();
  $actual = $this->entityStorage
    ->getRevisionDataTable();
  $this
    ->assertSame($expected, $actual);
}