function DefaultTableMappingTest::setUpDefinition

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::setUpDefinition()
  2. 10 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::setUpDefinition()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::setUpDefinition()

Sets up a field storage definition for the test.

Parameters

string $name: The field name.

array $column_names: An array of column names for the storage definition.

Return value

\Drupal\Core\Field\FieldStorageDefinitionInterface|\PHPUnit\Framework\MockObject\MockObject

6 calls to DefaultTableMappingTest::setUpDefinition()
DefaultTableMappingTest::testGetAllColumns in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Tests DefaultTableMapping::getAllColumns().
DefaultTableMappingTest::testGetColumnNames in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Tests DefaultTableMapping::getColumnNames().
DefaultTableMappingTest::testGetDedicatedTableName in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
@covers ::getDedicatedDataTableName @covers ::getDedicatedRevisionTableName
DefaultTableMappingTest::testGetFieldColumnName in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Tests DefaultTableMapping::getFieldColumnName() with valid parameters.
DefaultTableMappingTest::testGetFieldColumnNameInvalid in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Tests DefaultTableMapping::getFieldColumnName() with invalid parameters.

... See full list

File

core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php, line 596

Class

DefaultTableMappingTest
@coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity

Namespace

Drupal\Tests\Core\Entity\Sql

Code

protected function setUpDefinition($name, array $column_names, $base_field = TRUE) {
    $definition = $this->createMock('Drupal\\Tests\\Core\\Field\\TestBaseFieldDefinitionInterface');
    $definition->expects($this->any())
        ->method('isBaseField')
        ->willReturn($base_field);
    $definition->expects($this->any())
        ->method('getName')
        ->will($this->returnValue($name));
    $definition->expects($this->any())
        ->method('getColumns')
        ->will($this->returnValue(array_fill_keys($column_names, [])));
    return $definition;
}

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