protected function DefaultTableMappingTest::setUpDefinition in Drupal 9
Same name and namespace in other branches
- 8 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.
bool $base_field: Flag indicating whether the field should be treated as a base or bundle field.
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.
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ Sql/ DefaultTableMappingTest.php, line 587
Class
- DefaultTableMappingTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
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;
}