Drupal 8  8.0.2
SchemaTest Class Reference
Inheritance diagram for SchemaTest:

Public Member Functions

 testSchema ()
 
 testIndexLength ()
 
 tryInsert ($table= 'test_table')
 
 checkSchemaComment ($description, $table, $column=NULL)
 
 testUnsignedColumns ()
 
 tryUnsignedInsert ($table_name, $column_name)
 
 testSchemaAddField ()
 
 testSchemaChangeField ()
 
 testFindTables ()
 

Protected Member Functions

 assertFieldAdditionRemoval ($field_spec)
 
 assertFieldCharacteristics ($table_name, $field_name, $field_spec)
 
 assertFieldChange ($old_spec, $new_spec, $test_data=NULL)
 

Protected Attributes

 $counter
 

Detailed Description

Tests table creation and modification via the schema API.

Database

Member Function Documentation

assertFieldAdditionRemoval (   $field_spec)
protected

Asserts that a given field can be added and removed from a table.

The addition test covers both defining a field of a given specification when initially creating at table and extending an existing table.

Parameters
$field_specThe schema specification of the field.

References SchemaTest\assertFieldCharacteristics(), db_add_field(), db_create_table(), db_drop_field(), db_drop_table(), db_insert(), and format_string().

Referenced by SchemaTest\testSchemaAddField().

Here is the call graph for this function:

Here is the caller graph for this function:

assertFieldChange (   $old_spec,
  $new_spec,
  $test_data = NULL 
)
protected

Asserts that a field can be changed from one spec to another.

Parameters
$old_specThe beginning field specification.
$new_specThe ending field specification.

References SchemaTest\assertFieldCharacteristics(), db_change_field(), db_create_table(), db_drop_table(), db_insert(), db_select(), db_truncate(), and format_string().

Referenced by SchemaTest\testSchemaChangeField().

Here is the call graph for this function:

Here is the caller graph for this function:

assertFieldCharacteristics (   $table_name,
  $field_name,
  $field_spec 
)
protected

Asserts that a newly added field has the correct characteristics.

References db_insert(), and db_select().

Referenced by SchemaTest\assertFieldAdditionRemoval(), and SchemaTest\assertFieldChange().

Here is the call graph for this function:

Here is the caller graph for this function:

checkSchemaComment (   $description,
  $table,
  $column = NULL 
)

Checks that a table or column comment matches a given description.

Parameters
$descriptionThe asserted description.
$tableThe table to test.
$columnOptional column to test.

References Database\getConnection(), and Unicode\truncate().

Referenced by SchemaTest\testSchema().

Here is the call graph for this function:

Here is the caller graph for this function:

testFindTables ( )

Tests the findTables() method.

References Database\addConnectionInfo(), Database\getConnection(), Database\getConnectionInfo(), and Database\setActiveConnection().

Here is the call graph for this function:

testIndexLength ( )

Tests that indexes on string fields are limited to 191 characters on MySQL.

See Also
::getNormalizedIndexes()

References db_create_table(), db_query(), and Database\getConnection().

Here is the call graph for this function:

testSchema ( )

Tests database interactions.

References SchemaTest\checkSchemaComment(), db_add_field(), db_add_index(), db_change_field(), db_create_table(), db_drop_table(), db_field_set_default(), db_field_set_no_default(), db_query(), db_rename_table(), db_table_exists(), Database\getConnection(), and SchemaTest\tryInsert().

Here is the call graph for this function:

testSchemaAddField ( )

Tests adding columns to an existing table.

References SchemaTest\assertFieldAdditionRemoval().

Here is the call graph for this function:

testSchemaChangeField ( )

Tests changing columns between types.

References SchemaTest\assertFieldChange().

Here is the call graph for this function:

testUnsignedColumns ( )

Tests creating unsigned columns and data integrity thereof.

References db_add_field(), db_create_table(), db_field_exists(), format_string(), and SchemaTest\tryUnsignedInsert().

Here is the call graph for this function:

tryInsert (   $table = 'test_table')

Tests inserting data into an existing table.

Parameters
$tableThe database table to insert data into.
Returns
TRUE if the insert succeeded, FALSE otherwise.

References db_insert().

Referenced by SchemaTest\testSchema().

Here is the call graph for this function:

Here is the caller graph for this function:

tryUnsignedInsert (   $table_name,
  $column_name 
)

Tries to insert a negative value into columns defined as unsigned.

Parameters
$table_nameThe table to insert.
$column_nameThe column to insert.
Returns
TRUE if the insert succeeded, FALSE otherwise.

References db_insert().

Referenced by SchemaTest\testUnsignedColumns().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$counter
protected

A global counter for table and field creation.


The documentation for this class was generated from the following file: