protected function DefaultTableMappingTest::setUpDefinition in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::setUpDefinition()
- 9 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
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ Sql/ DefaultTableMappingTest.php, line 590
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;
}