/** * Initializes common information for a revision data table. * * @return array * A partial schema array for the revision data table. */ protected function initializeRevisionDataTable() { $entity_type_id = $this->entityType->id(); $id_key = $this->entityType->getKey('id'); $revision_key = $this->entityType->getKey('revision'); $schema = array('description' => "The revision data table for {$entity_type_id} entities.", 'primary key' => array($revision_key, 'langcode'), 'indexes' => array(), 'foreign keys' => array($entity_type_id => array('table' => $this->storage->getBaseTable(), 'columns' => array($id_key => $id_key)), $entity_type_id . '__revision' => array('table' => $this->storage->getRevisionTable(), 'columns' => array($revision_key => $revision_key)))); $this->addTableDefaults($schema); return $schema; }
/** * Tests ContentEntityDatabaseStorage::getBaseTable(). * * @param string $base_table * The base table to be returned by the mocked entity type. * @param string $expected * The expected return value of * ContentEntityDatabaseStorage::getBaseTable(). * * @covers ::__construct() * @covers ::getBaseTable() * * @dataProvider providerTestGetBaseTable */ public function testGetBaseTable($base_table, $expected) { $this->entityType->expects($this->once())->method('getBaseTable')->will($this->returnValue('entity_test')); $this->setUpEntityStorage(); $this->assertSame($expected, $this->entityStorage->getBaseTable()); }