function SqlContentEntityStorageTest::testGetRevisionDataTable

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetRevisionDataTable()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testGetRevisionDataTable()
  3. 11.x 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 271

Class

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

Namespace

Drupal\Tests\Core\Entity\Sql

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.