You are here

protected function SqlContentEntityStorageSchemaTest::setUp in Drupal 8

Same name in this branch
  1. 8 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageSchemaTest::setUp()
  2. 8 core/tests/Drupal/KernelTests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php \Drupal\KernelTests\Core\Entity\Sql\SqlContentEntityStorageSchemaTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php, line 79

Class

SqlContentEntityStorageSchemaTest
@coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema @group Entity

Namespace

Drupal\Tests\Core\Entity\Sql

Code

protected function setUp() {
  $this->entityTypeManager = $this
    ->createMock(EntityTypeManager::class);
  $this->entityFieldManager = $this
    ->createMock(EntityFieldManager::class);
  $this->entityLastInstalledSchemaRepository = $this
    ->createMock(EntityLastInstalledSchemaRepositoryInterface::class);
  $this->storage = $this
    ->getMockBuilder('Drupal\\Core\\Entity\\Sql\\SqlContentEntityStorage')
    ->disableOriginalConstructor()
    ->getMock();
  $this->storage
    ->expects($this
    ->any())
    ->method('getBaseTable')
    ->will($this
    ->returnValue('entity_test'));

  // Add an ID field. This also acts as a test for a simple, single-column
  // field.
  $this
    ->setUpStorageDefinition('id', [
    'columns' => [
      'value' => [
        'type' => 'int',
      ],
    ],
  ]);
}