class StubSchema
A stub of the abstract Schema class for testing purposes.
Includes minimal implementations of Schema's abstract methods.
Hierarchy
- class \Drupal\Core\Database\Schema implements \Drupal\Core\Database\Query\PlaceholderInterface
- class \Drupal\Tests\Core\Database\Stub\StubSchema extends \Drupal\Core\Database\Schema
Expanded class hierarchy of StubSchema
2 files declare their use of StubSchema
- InstallerRedirectTraitTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Installer/ InstallerRedirectTraitTest.php - Schema.php in core/
tests/ fixtures/ database_drivers/ module/ core_fake/ src/ Driver/ Database/ CoreFakeWithAllCustomClasses/ Schema.php
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ Stub/ StubSchema.php, line 14
Namespace
Drupal\Tests\Core\Database\StubView source
class StubSchema extends DatabaseSchema {
/**
* {@inheritdoc}
*/
public function getFieldTypeMap() {
return [];
}
/**
* {@inheritdoc}
*/
public function renameTable($table, $new_name) {
}
/**
* {@inheritdoc}
*/
public function dropTable($table) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function addField($table, $field, $spec, $keys_new = []) {
}
/**
* {@inheritdoc}
*/
public function dropField($table, $field) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function indexExists($table, $name) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function addPrimaryKey($table, $fields) {
}
/**
* {@inheritdoc}
*/
public function dropPrimaryKey($table) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function addUniqueKey($table, $name, $fields) {
}
/**
* {@inheritdoc}
*/
public function dropUniqueKey($table, $name) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function addIndex($table, $name, $fields, array $spec) {
}
/**
* {@inheritdoc}
*/
public function dropIndex($table, $name) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function changeField($table, $field, $field_new, $spec, $keys_new = []) {
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Schema::$connection | protected | property | The database connection. | ||
Schema::$defaultSchema | protected | property | Definition of prefixInfo array structure. | 1 | |
Schema::$placeholder | protected | property | The placeholder counter. | ||
Schema::$uniqueIdentifier | protected | property | A unique identifier for this query object. | ||
Schema::buildTableNameCondition | protected | function | Build a condition to match a table name against a standard information_schema. | 1 | |
Schema::createTable | public | function | Create a new table from a Drupal table definition. | ||
Schema::createTableSql | protected | function | Generate SQL to create a new table from a Drupal schema definition. | 3 | |
Schema::ensureNotNullPrimaryKey | protected | function | Ensures that all the primary key fields are correctly defined. | ||
Schema::escapeDefaultValue | protected | function | Escapes a value to be used as the default value on a column. | ||
Schema::fieldExists | public | function | Check if a column exists in the given table. | 2 | |
Schema::fieldNames | public | function | Return an array of field names from an array of key/index column specifiers. | ||
Schema::findPrimaryKeyColumns | protected | function | Finds the primary key columns of a table, from the database. | 3 | |
Schema::findTables | public | function | Finds all tables that are like the specified base table name. | 2 | |
Schema::getPrefixInfo | protected | function | Get information about the table name and schema from the prefix. | 1 | |
Schema::introspectIndexSchema | protected | function | Finds the columns for the primary key, unique keys and indexes of a table. | 3 | |
Schema::nextPlaceholder | public | function | Returns the next placeholder ID for the query. | Overrides PlaceholderInterface::nextPlaceholder | |
Schema::prefixNonTable | public | function | Create names for indexes, primary keys and constraints. | ||
Schema::prepareComment | public | function | Prepare a table or column comment for database query. | 1 | |
Schema::tableExists | public | function | Check if a table exists. | 2 | |
Schema::uniqueIdentifier | public | function | Returns a unique identifier for this object. | Overrides PlaceholderInterface::uniqueIdentifier | |
Schema::__clone | public | function | Implements the magic __clone function. | ||
Schema::__construct | public | function | 1 | ||
StubSchema::addField | public | function | Add a new field to a table. | Overrides Schema::addField | |
StubSchema::addIndex | public | function | Add an index. | Overrides Schema::addIndex | |
StubSchema::addPrimaryKey | public | function | Add a primary key. | Overrides Schema::addPrimaryKey | |
StubSchema::addUniqueKey | public | function | Add a unique key. | Overrides Schema::addUniqueKey | |
StubSchema::changeField | public | function | Change a field definition. | Overrides Schema::changeField | |
StubSchema::dropField | public | function | Drop a field. | Overrides Schema::dropField | |
StubSchema::dropIndex | public | function | Drop an index. | Overrides Schema::dropIndex | |
StubSchema::dropPrimaryKey | public | function | Drop the primary key. | Overrides Schema::dropPrimaryKey | |
StubSchema::dropTable | public | function | Drop a table. | Overrides Schema::dropTable | |
StubSchema::dropUniqueKey | public | function | Drop a unique key. | Overrides Schema::dropUniqueKey | |
StubSchema::getFieldTypeMap | public | function | Returns a mapping of Drupal schema field names to DB-native field types. | Overrides Schema::getFieldTypeMap | |
StubSchema::indexExists | public | function | Checks if an index exists in the given table. | Overrides Schema::indexExists | |
StubSchema::renameTable | public | function | Rename a table. | Overrides Schema::renameTable |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.