You are here

protected function DefaultTableMappingTest::setUpDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

5 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::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.
DefaultTableMappingTest::testGetFieldTableName in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Tests DefaultTableMapping::getFieldTableName().

File

core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php, line 459
Contains \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest.

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
    ->getMock('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;
}