/**
* The storage schema handler used in this test.
*
- * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema|\PHPUnit_Framework_MockObject_MockObject.
+ * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema|\PHPUnit_Framework_MockObject_MockObject
*/
protected $storageSchema;
],
'domain' => [
'type' => 'varchar',
- ]
+ ],
],
'unique keys' => [
'email' => ['username', 'hostname', ['domain', 3]],
],
'city' => [
'type' => 'varchar',
- ]
+ ],
],
'indexes' => [
'country_state_city' => ['country', 'state', ['city', 10]],
$this->storage->expects($this->any())
->method('getTableMapping')
->will($this->returnValue($table_mapping));
+ $this->storage->expects($this->any())
+ ->method('getCustomTableMapping')
+ ->will($this->returnValue($table_mapping));
$this->assertNull(
$this->storageSchema->onEntityTypeCreate($this->entityType)
* @covers ::processIdentifierSchema
*/
public function testGetSchemaRevisionable() {
- $this->entityType = new ContentEntityType([
- 'id' => 'entity_test',
- 'entity_keys' => [
- 'id' => 'id',
- 'revision' => 'revision_id',
- ],
- ]);
+ $this->entityType = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityType')
+ ->setConstructorArgs([
+ [
+ 'id' => 'entity_test',
+ 'entity_keys' => [
+ 'id' => 'id',
+ 'revision' => 'revision_id',
+ ],
+ ],
+ ])
+ ->setMethods(['getRevisionMetadataKeys'])
+ ->getMock();
+
+ $this->entityType->expects($this->any())
+ ->method('getRevisionMetadataKeys')
+ ->will($this->returnValue([]));
$this->storage->expects($this->exactly(2))
->method('getRevisionTable')
'revision_id' => [
'type' => 'int',
'not null' => FALSE,
- ]
+ ],
],
'primary key' => ['id'],
'unique keys' => [
'entity_test__revision' => [
'table' => 'entity_test_revision',
'columns' => ['revision_id' => 'revision_id'],
- ]
+ ],
],
],
'entity_test_revision' => [
$this->storage->expects($this->any())
->method('getTableMapping')
->will($this->returnValue($table_mapping));
+ $this->storage->expects($this->any())
+ ->method('getCustomTableMapping')
+ ->will($this->returnValue($table_mapping));
$this->storageSchema->onEntityTypeCreate($this->entityType);
}
'langcode' => [
'type' => 'varchar',
'not null' => TRUE,
- ]
+ ],
],
'primary key' => ['id'],
'unique keys' => [],
$this->storage->expects($this->any())
->method('getTableMapping')
->will($this->returnValue($table_mapping));
+ $this->storage->expects($this->any())
+ ->method('getCustomTableMapping')
+ ->will($this->returnValue($table_mapping));
$this->assertNull(
$this->storageSchema->onEntityTypeCreate($this->entityType)
* @covers ::processRevisionDataTable
*/
public function testGetSchemaRevisionableTranslatable() {
- $this->entityType = new ContentEntityType([
- 'id' => 'entity_test',
- 'entity_keys' => [
- 'id' => 'id',
- 'revision' => 'revision_id',
- 'langcode' => 'langcode',
- ],
- ]);
+ $this->entityType = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityType')
+ ->setConstructorArgs([
+ [
+ 'id' => 'entity_test',
+ 'entity_keys' => [
+ 'id' => 'id',
+ 'revision' => 'revision_id',
+ 'langcode' => 'langcode',
+ ],
+ ],
+ ])
+ ->setMethods(['getRevisionMetadataKeys'])
+ ->getMock();
+
+ $this->entityType->expects($this->any())
+ ->method('getRevisionMetadataKeys')
+ ->will($this->returnValue([]));
$this->storage->expects($this->exactly(3))
->method('getRevisionTable')
'langcode' => [
'type' => 'varchar',
'not null' => TRUE,
- ]
+ ],
],
'primary key' => ['id'],
'unique keys' => [
$this->storage->expects($this->any())
->method('getTableMapping')
->will($this->returnValue($table_mapping));
+ $this->storage->expects($this->any())
+ ->method('getCustomTableMapping')
+ ->will($this->returnValue($table_mapping));
$this->storageSchema->onEntityTypeCreate($this->entityType);
}
'color' => [
'table' => 'color',
'columns' => [
- 'color' => 'id'
+ 'color' => 'id',
],
],
],
'color' => [
'table' => 'color',
'columns' => [
- 'color' => 'id'
+ 'color' => 'id',
],
],
],
$this->storage->expects($this->any())
->method('getTableMapping')
->will($this->returnValue($table_mapping));
+ $this->storage->expects($this->any())
+ ->method('getCustomTableMapping')
+ ->will($this->returnValue($table_mapping));
// Setup storage schema.
if ($change_schema) {
$this->storage->expects($this->any())
->method('getTableMapping')
->will($this->returnValue($table_mapping));
+ $this->storage->expects($this->any())
+ ->method('getCustomTableMapping')
+ ->will($this->returnValue($table_mapping));
$this->storageSchema->expects($this->any())
->method('loadEntitySchemaData')