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. 10 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 270

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);
}

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