Unit test class for storage-related field_attach_* functions.
All field_attach_* test work with all field_storage plugins and all hook_field_attach_pre_{load,insert,update}() hooks.
Expanded class hierarchy of FieldAttachStorageTest
class FieldAttachStorageTest extends FieldUnitTestBase {
public static function getInfo() {
return array(
'name' => 'Field attach tests (storage-related)',
'description' => 'Test storage-related Field Attach API functions.',
'group' => 'Field API',
);
}
public function setUp() {
parent::setUp();
$this
->createFieldWithInstance();
}
/**
* Check field values insert, update and load.
*
* Works independently of the underlying field storage backend. Inserts or
* updates random field data and then loads and verifies the data.
*/
function testFieldAttachSaveLoad() {
// Configure the instance so that we test hook_field_load() (see
// field_test_field_load() in field_test.module).
$this->instance['settings']['test_hook_field_load'] = TRUE;
field_update_instance($this->instance);
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$entity_type = 'test_entity';
$values = array();
// TODO : test empty values filtering and "compression" (store consecutive deltas).
// Preparation: create three revisions and store them in $revision array.
for ($revision_id = 0; $revision_id < 3; $revision_id++) {
$revision[$revision_id] = field_test_create_entity(0, $revision_id, $this->instance['bundle']);
// Note: we try to insert one extra value.
$values[$revision_id] = $this
->_generateTestFieldValues($this->field['cardinality'] + 1);
$current_revision = $revision_id;
// If this is the first revision do an insert.
if (!$revision_id) {
$revision[$revision_id]->{$this->field_name}[$langcode] = $values[$revision_id];
field_attach_insert($revision[$revision_id]);
}
else {
// Otherwise do an update.
$revision[$revision_id]->{$this->field_name}[$langcode] = $values[$revision_id];
field_attach_update($revision[$revision_id]);
}
}
// Confirm current revision loads the correct data.
$entity = field_test_create_entity(0, 0, $this->instance['bundle']);
field_attach_load($entity_type, array(
0 => $entity,
));
// Number of values per field loaded equals the field cardinality.
$this
->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], 'Current revision: expected number of values');
for ($delta = 0; $delta < $this->field['cardinality']; $delta++) {
// The field value loaded matches the one inserted or updated.
$this
->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array(
'%delta' => $delta,
)));
// The value added in hook_field_load() is found.
$this
->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', format_string('Current revision: extra information for value %delta was found', array(
'%delta' => $delta,
)));
}
// Confirm each revision loads the correct data.
foreach (array_keys($revision) as $revision_id) {
$entity = field_test_create_entity(0, $revision_id, $this->instance['bundle']);
field_attach_load_revision($entity_type, array(
0 => $entity,
));
// Number of values per field loaded equals the field cardinality.
$this
->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], format_string('Revision %revision_id: expected number of values.', array(
'%revision_id' => $revision_id,
)));
for ($delta = 0; $delta < $this->field['cardinality']; $delta++) {
// The field value loaded matches the one inserted or updated.
$this
->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$revision_id][$delta]['value'], format_string('Revision %revision_id: expected value %delta was found.', array(
'%revision_id' => $revision_id,
'%delta' => $delta,
)));
// The value added in hook_field_load() is found.
$this
->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', format_string('Revision %revision_id: extra information for value %delta was found', array(
'%revision_id' => $revision_id,
'%delta' => $delta,
)));
}
}
}
/**
* Test the 'multiple' load feature.
*/
function testFieldAttachLoadMultiple() {
$entity_type = 'test_entity';
$langcode = Language::LANGCODE_NOT_SPECIFIED;
// Define 2 bundles.
$bundles = array(
1 => 'test_bundle_1',
2 => 'test_bundle_2',
);
field_test_create_bundle($bundles[1]);
field_test_create_bundle($bundles[2]);
// Define 3 fields:
// - field_1 is in bundle_1 and bundle_2,
// - field_2 is in bundle_1,
// - field_3 is in bundle_2.
$field_bundles_map = array(
1 => array(
1,
2,
),
2 => array(
1,
),
3 => array(
2,
),
);
for ($i = 1; $i <= 3; $i++) {
$field_names[$i] = 'field_' . $i;
$field = array(
'field_name' => $field_names[$i],
'type' => 'test_field',
);
$field = field_create_field($field);
$field_ids[$i] = $field['uuid'];
foreach ($field_bundles_map[$i] as $bundle) {
$instance = array(
'field_name' => $field_names[$i],
'entity_type' => 'test_entity',
'bundle' => $bundles[$bundle],
'settings' => array(
// Configure the instance so that we test hook_field_load()
// (see field_test_field_load() in field_test.module).
'test_hook_field_load' => TRUE,
),
);
field_create_instance($instance);
}
}
// Create one test entity per bundle, with random values.
foreach ($bundles as $index => $bundle) {
$entities[$index] = field_test_create_entity($index, $index, $bundle);
$entity = clone $entities[$index];
$instances = field_info_instances('test_entity', $bundle);
foreach ($instances as $field_name => $instance) {
$values[$index][$field_name] = mt_rand(1, 127);
$entity->{$field_name} = array(
$langcode => array(
array(
'value' => $values[$index][$field_name],
),
),
);
}
field_attach_insert($entity);
}
// Check that a single load correctly loads field values for both entities.
field_attach_load($entity_type, $entities);
foreach ($entities as $index => $entity) {
$instances = field_info_instances($entity_type, $bundles[$index]);
foreach ($instances as $field_name => $instance) {
// The field value loaded matches the one inserted.
$this
->assertEqual($entity->{$field_name}[$langcode][0]['value'], $values[$index][$field_name], format_string('Entity %index: expected value was found.', array(
'%index' => $index,
)));
// The value added in hook_field_load() is found.
$this
->assertEqual($entity->{$field_name}[$langcode][0]['additional_key'], 'additional_value', format_string('Entity %index: extra information was found', array(
'%index' => $index,
)));
}
}
// Check that the single-field load option works.
$entity = field_test_create_entity(1, 1, $bundles[1]);
field_attach_load($entity_type, array(
1 => $entity,
), FIELD_LOAD_CURRENT, array(
'field_id' => $field_ids[1],
));
$this
->assertEqual($entity->{$field_names[1]}[$langcode][0]['value'], $values[1][$field_names[1]], format_string('Entity %index: expected value was found.', array(
'%index' => 1,
)));
$this
->assertEqual($entity->{$field_names[1]}[$langcode][0]['additional_key'], 'additional_value', format_string('Entity %index: extra information was found', array(
'%index' => 1,
)));
$this
->assert(!isset($entity->{$field_names[2]}), format_string('Entity %index: field %field_name is not loaded.', array(
'%index' => 2,
'%field_name' => $field_names[2],
)));
$this
->assert(!isset($entity->{$field_names[3]}), format_string('Entity %index: field %field_name is not loaded.', array(
'%index' => 3,
'%field_name' => $field_names[3],
)));
}
/**
* Test saving and loading fields using different storage backends.
*/
function testFieldAttachSaveLoadDifferentStorage() {
$entity_type = 'test_entity';
$langcode = Language::LANGCODE_NOT_SPECIFIED;
// Create two fields using different storage backends, and their instances.
$fields = array(
array(
'field_name' => 'field_1',
'type' => 'test_field',
'cardinality' => 4,
'storage' => array(
'type' => 'field_sql_storage',
),
),
array(
'field_name' => 'field_2',
'type' => 'test_field',
'cardinality' => 4,
'storage' => array(
'type' => 'field_test_storage',
),
),
);
foreach ($fields as $field) {
field_create_field($field);
$instance = array(
'field_name' => $field['field_name'],
'entity_type' => 'test_entity',
'bundle' => 'test_bundle',
);
field_create_instance($instance);
}
$entity_init = field_test_create_entity();
// Create entity and insert random values.
$entity = clone $entity_init;
$values = array();
foreach ($fields as $field) {
$values[$field['field_name']] = $this
->_generateTestFieldValues($this->field['cardinality']);
$entity->{$field['field_name']}[$langcode] = $values[$field['field_name']];
}
field_attach_insert($entity);
// Check that values are loaded as expected.
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
foreach ($fields as $field) {
$this
->assertEqual($values[$field['field_name']], $entity->{$field['field_name']}[$langcode], format_string('%storage storage: expected values were found.', array(
'%storage' => $field['storage']['type'],
)));
}
}
/**
* Test storage details alteration.
*
* @see field_test_storage_details_alter()
*/
function testFieldStorageDetailsAlter() {
$field_name = 'field_test_change_my_details';
$field = array(
'field_name' => $field_name,
'type' => 'test_field',
'cardinality' => 4,
'storage' => array(
'type' => 'field_test_storage',
),
);
$field = field_create_field($field);
$instance = array(
'field_name' => $field_name,
'entity_type' => 'test_entity',
'bundle' => 'test_bundle',
);
field_create_instance($instance);
$field = field_info_field($instance['field_name']);
$instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']);
// The storage details are indexed by a storage engine type.
$this
->assertTrue(array_key_exists('drupal_variables', $field['storage_details']), 'The storage type is Drupal variables.');
$details = $field['storage_details']['drupal_variables'];
// The field_test storage details are indexed by variable name. The details
// are altered, so moon and mars are correct for this test.
$this
->assertTrue(array_key_exists('moon', $details[FIELD_LOAD_CURRENT]), 'Moon is available in the instance array.');
$this
->assertTrue(array_key_exists('mars', $details[FIELD_LOAD_REVISION]), 'Mars is available in the instance array.');
// Test current and revision storage details together because the columns
// are the same.
foreach ($field['columns'] as $column_name => $attributes) {
$this
->assertEqual($details[FIELD_LOAD_CURRENT]['moon'][$column_name], $column_name, format_string('Column name %value matches the definition in %bin.', array(
'%value' => $column_name,
'%bin' => 'moon[FIELD_LOAD_CURRENT]',
)));
$this
->assertEqual($details[FIELD_LOAD_REVISION]['mars'][$column_name], $column_name, format_string('Column name %value matches the definition in %bin.', array(
'%value' => $column_name,
'%bin' => 'mars[FIELD_LOAD_REVISION]',
)));
}
}
/**
* Tests insert and update with missing or NULL fields.
*/
function testFieldAttachSaveMissingData() {
$entity_type = 'test_entity';
$entity_init = field_test_create_entity();
$langcode = Language::LANGCODE_NOT_SPECIFIED;
// Insert: Field is missing.
$entity = clone $entity_init;
field_attach_insert($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertTrue(empty($entity->{$this->field_name}), 'Insert: missing field results in no value saved');
// Insert: Field is NULL.
field_cache_clear();
$entity = clone $entity_init;
$entity->{$this->field_name} = NULL;
field_attach_insert($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertTrue(empty($entity->{$this->field_name}), 'Insert: NULL field results in no value saved');
// Add some real data.
field_cache_clear();
$entity = clone $entity_init;
$values = $this
->_generateTestFieldValues(1);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_insert($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Field data saved');
// Update: Field is missing. Data should survive.
field_cache_clear();
$entity = clone $entity_init;
field_attach_update($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Update: missing field leaves existing values in place');
// Update: Field is NULL. Data should be wiped.
field_cache_clear();
$entity = clone $entity_init;
$entity->{$this->field_name} = NULL;
field_attach_update($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertTrue(empty($entity->{$this->field_name}), 'Update: NULL field removes existing values');
// Re-add some data.
field_cache_clear();
$entity = clone $entity_init;
$values = $this
->_generateTestFieldValues(1);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_update($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Field data saved');
// Update: Field is empty array. Data should be wiped.
field_cache_clear();
$entity = clone $entity_init;
$entity->{$this->field_name} = array();
field_attach_update($entity);
$entity = clone $entity_init;
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertTrue(empty($entity->{$this->field_name}), 'Update: empty array removes existing values');
}
/**
* Test insert with missing or NULL fields, with default value.
*/
function testFieldAttachSaveMissingDataDefaultValue() {
// Add a default value function.
$this->instance['default_value_function'] = 'field_test_default_value';
field_update_instance($this->instance);
// Verify that fields are populated with default values.
$entity_type = 'test_entity';
$entity_init = field_test_create_entity();
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$default = field_test_default_value($entity_init, $this->field, $this->instance);
$this
->assertEqual($entity_init->{$this->field_name}[$langcode], $default, 'Default field value correctly populated.');
// Insert: Field is NULL.
$entity = clone $entity_init;
$entity->{$this->field_name}[$langcode] = NULL;
field_attach_insert($entity);
$entity = clone $entity_init;
$entity->{$this->field_name} = array();
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertTrue(empty($entity->{$this->field_name}[$langcode]), 'Insert: NULL field results in no value saved');
// Insert: Field is missing.
field_cache_clear();
$entity = clone $entity_init;
field_attach_insert($entity);
$entity = clone $entity_init;
$entity->{$this->field_name} = array();
field_attach_load($entity_type, array(
$entity->ftid => $entity,
));
$this
->assertEqual($entity->{$this->field_name}[$langcode], $default, 'Insert: missing field results in default value saved');
// Verify that prepopulated field values are not overwritten by defaults.
$value = array(
array(
'value' => $default[0]['value'] - mt_rand(1, 127),
),
);
$entity = entity_create('test_entity', array(
'fttype' => $entity_init
->bundle(),
$this->field_name => array(
$langcode => $value,
),
));
$this
->assertEqual($entity->{$this->field_name}[$langcode], $value, 'Prepopulated field value correctly maintained.');
}
/**
* Test field_attach_delete().
*/
function testFieldAttachDelete() {
$entity_type = 'test_entity';
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$rev[0] = field_test_create_entity(0, 0, $this->instance['bundle']);
// Create revision 0
$values = $this
->_generateTestFieldValues($this->field['cardinality']);
$rev[0]->{$this->field_name}[$langcode] = $values;
field_attach_insert($rev[0]);
// Create revision 1
$rev[1] = field_test_create_entity(0, 1, $this->instance['bundle']);
$rev[1]->{$this->field_name}[$langcode] = $values;
field_attach_update($rev[1]);
// Create revision 2
$rev[2] = field_test_create_entity(0, 2, $this->instance['bundle']);
$rev[2]->{$this->field_name}[$langcode] = $values;
field_attach_update($rev[2]);
// Confirm each revision loads
foreach (array_keys($rev) as $vid) {
$read = field_test_create_entity(0, $vid, $this->instance['bundle']);
field_attach_load_revision($entity_type, array(
0 => $read,
));
$this
->assertEqual(count($read->{$this->field_name}[$langcode]), $this->field['cardinality'], "The test entity revision {$vid} has {$this->field['cardinality']} values.");
}
// Delete revision 1, confirm the other two still load.
field_attach_delete_revision($rev[1]);
foreach (array(
0,
2,
) as $vid) {
$read = field_test_create_entity(0, $vid, $this->instance['bundle']);
field_attach_load_revision($entity_type, array(
0 => $read,
));
$this
->assertEqual(count($read->{$this->field_name}[$langcode]), $this->field['cardinality'], "The test entity revision {$vid} has {$this->field['cardinality']} values.");
}
// Confirm the current revision still loads
$read = field_test_create_entity(0, 2, $this->instance['bundle']);
field_attach_load($entity_type, array(
0 => $read,
));
$this
->assertEqual(count($read->{$this->field_name}[$langcode]), $this->field['cardinality'], "The test entity current revision has {$this->field['cardinality']} values.");
// Delete all field data, confirm nothing loads
field_attach_delete($rev[2]);
foreach (array(
0,
1,
2,
) as $vid) {
$read = field_test_create_entity(0, $vid, $this->instance['bundle']);
field_attach_load_revision($entity_type, array(
0 => $read,
));
$this
->assertIdentical($read->{$this->field_name}, array(), "The test entity revision {$vid} is deleted.");
}
$read = field_test_create_entity(0, 2, $this->instance['bundle']);
field_attach_load($entity_type, array(
0 => $read,
));
$this
->assertIdentical($read->{$this->field_name}, array(), 'The test entity current revision is deleted.');
}
/**
* Test entity_bundle_create() and entity_bundle_rename().
*/
function testEntityCreateRenameBundle() {
// Create a new bundle.
$new_bundle = 'test_bundle_' . drupal_strtolower($this
->randomName());
field_test_create_bundle($new_bundle);
// Add an instance to that bundle.
$this->instance['bundle'] = $new_bundle;
field_create_instance($this->instance);
// Save an entity with data in the field.
$entity = field_test_create_entity(0, 0, $this->instance['bundle']);
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$values = $this
->_generateTestFieldValues($this->field['cardinality']);
$entity->{$this->field_name}[$langcode] = $values;
$entity_type = 'test_entity';
field_attach_insert($entity);
// Verify the field data is present on load.
$entity = field_test_create_entity(0, 0, $this->instance['bundle']);
field_attach_load($entity_type, array(
0 => $entity,
));
$this
->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], "Data is retrieved for the new bundle");
// Rename the bundle.
$new_bundle = 'test_bundle_' . drupal_strtolower($this
->randomName());
field_test_rename_bundle($this->instance['bundle'], $new_bundle);
// Check that the instance definition has been updated.
$this->instance = field_info_instance($entity_type, $this->field_name, $new_bundle);
$this
->assertIdentical($this->instance['bundle'], $new_bundle, "Bundle name has been updated in the instance.");
// Verify the field data is present on load.
$entity = field_test_create_entity(0, 0, $new_bundle);
field_attach_load($entity_type, array(
0 => $entity,
));
$this
->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], "Bundle name has been updated in the field storage");
}
/**
* Test entity_bundle_delete().
*/
function testEntityDeleteBundle() {
// Create a new bundle.
$new_bundle = 'test_bundle_' . drupal_strtolower($this
->randomName());
field_test_create_bundle($new_bundle);
// Add an instance to that bundle.
$this->instance['bundle'] = $new_bundle;
field_create_instance($this->instance);
// Create a second field for the test bundle
$field_name = drupal_strtolower($this
->randomName() . '_field_name');
$field = array(
'field_name' => $field_name,
'type' => 'test_field',
'cardinality' => 1,
);
field_create_field($field);
$instance = array(
'field_name' => $field_name,
'entity_type' => 'test_entity',
'bundle' => $this->instance['bundle'],
'label' => $this
->randomName() . '_label',
'description' => $this
->randomName() . '_description',
'weight' => mt_rand(0, 127),
);
field_create_instance($instance);
// Save an entity with data for both fields
$entity = field_test_create_entity(0, 0, $this->instance['bundle']);
$langcode = Language::LANGCODE_NOT_SPECIFIED;
$values = $this
->_generateTestFieldValues($this->field['cardinality']);
$entity->{$this->field_name}[$langcode] = $values;
$entity->{$field_name}[$langcode] = $this
->_generateTestFieldValues(1);
field_attach_insert($entity);
// Verify the fields are present on load
$entity = field_test_create_entity(0, 0, $this->instance['bundle']);
field_attach_load('test_entity', array(
0 => $entity,
));
$this
->assertEqual(count($entity->{$this->field_name}[$langcode]), 4, 'First field got loaded');
$this
->assertEqual(count($entity->{$field_name}[$langcode]), 1, 'Second field got loaded');
// Delete the bundle.
field_test_delete_bundle($this->instance['bundle']);
// Verify no data gets loaded
$entity = field_test_create_entity(0, 0, $this->instance['bundle']);
field_attach_load('test_entity', array(
0 => $entity,
));
$this
->assertFalse(isset($entity->{$this->field_name}[$langcode]), 'No data for first field');
$this
->assertFalse(isset($entity->{$field_name}[$langcode]), 'No data for second field');
// Verify that the instances are gone
$this
->assertFalse(field_read_instance('test_entity', $this->field_name, $this->instance['bundle']), "First field is deleted");
$this
->assertFalse(field_read_instance('test_entity', $field_name, $instance['bundle']), "Second field is deleted");
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalUnitTestBase:: |
protected | property | A KeyValueMemoryFactory instance to use when building the container. | |
DrupalUnitTestBase:: |
private | property | ||
DrupalUnitTestBase:: |
private | property | ||
DrupalUnitTestBase:: |
private | property | ||
DrupalUnitTestBase:: |
public | function | Sets up the base service container for this test. | 1 |
DrupalUnitTestBase:: |
protected | function | Disables modules for this test. | |
DrupalUnitTestBase:: |
protected | function | Enables modules for this test. | |
DrupalUnitTestBase:: |
protected | function | Installs default configuration for a given list of modules. | |
DrupalUnitTestBase:: |
protected | function | Installs a specific table from a module schema definition. | |
DrupalUnitTestBase:: |
protected | function |
Deletes created files, database tables, and reverts all environment changes. Overrides TestBase:: |
2 |
DrupalUnitTestBase:: |
function |
Overrides \Drupal\simpletest\UnitTestBase::__construct(). Overrides UnitTestBase:: |
||
FieldAttachStorageTest:: |
public static | function | ||
FieldAttachStorageTest:: |
public | function |
Set the default field storage backend for fields created during tests. Overrides FieldUnitTestBase:: |
|
FieldAttachStorageTest:: |
function | Test entity_bundle_create() and entity_bundle_rename(). | ||
FieldAttachStorageTest:: |
function | Test entity_bundle_delete(). | ||
FieldAttachStorageTest:: |
function | Test field_attach_delete(). | ||
FieldAttachStorageTest:: |
function | Test the 'multiple' load feature. | ||
FieldAttachStorageTest:: |
function | Check field values insert, update and load. | ||
FieldAttachStorageTest:: |
function | Test saving and loading fields using different storage backends. | ||
FieldAttachStorageTest:: |
function | Tests insert and update with missing or NULL fields. | ||
FieldAttachStorageTest:: |
function | Test insert with missing or NULL fields, with default value. | ||
FieldAttachStorageTest:: |
function | Test storage details alteration. | ||
FieldUnitTestBase:: |
protected | property | A string for assert raw and text helper methods. | |
FieldUnitTestBase:: |
public static | property |
Modules to enable. Overrides DrupalUnitTestBase:: |
15 |
FieldUnitTestBase:: |
function | Assert that a field has the expected values in an entity. | ||
FieldUnitTestBase:: |
protected | function | Pass if the raw text IS NOT found in set string. | |
FieldUnitTestBase:: |
protected | function | Pass if the text IS NOT found in set string. | |
FieldUnitTestBase:: |
protected | function | Pass if the raw text IS found in set string. | |
FieldUnitTestBase:: |
protected | function | Pass if the text IS found in set string. | |
FieldUnitTestBase:: |
function | Create a field and an instance of it. | ||
FieldUnitTestBase:: |
function | Generate random values for a field_test field. | ||
TestBase:: |
protected | property | Assertions thrown in that test case. | |
TestBase:: |
protected | property | The config importer that can used in a test. | 1 |
TestBase:: |
protected | property | The dependency injection container used in the test. | 1 |
TestBase:: |
protected | property | The database prefix of this test run. | |
TestBase:: |
public | property | Whether to die in case any test assertion fails. | |
TestBase:: |
protected | property | The original file directory, before it was changed for testing purposes. | |
TestBase:: |
protected | property | The original database prefix when running inside Simpletest. | |
TestBase:: |
protected | property | The settings array. | |
TestBase:: |
protected | property | The public file directory for the test environment. | |
TestBase:: |
public | property | Current results of this test case. | |
TestBase:: |
protected | property | Flag to indicate whether the test has been set up. | |
TestBase:: |
protected | property | ||
TestBase:: |
protected | property | ||
TestBase:: |
protected | property | This class is skipped when looking for the source of an assertion. | |
TestBase:: |
protected | property | The test run ID. | |
TestBase:: |
protected | property | Time limit for the test. | |
TestBase:: |
protected | property | TRUE if verbose debugging is enabled. | |
TestBase:: |
protected | property | Safe class name for use in verbose output filenames. | |
TestBase:: |
protected | property | Directory where verbose output files are put. | |
TestBase:: |
protected | property | URL to the verbose output file directory. | |
TestBase:: |
protected | property | Incrementing identifier for verbose output filenames. | |
TestBase:: |
protected | function | Internal helper: stores the assert. | |
TestBase:: |
protected | function | Check to see if two values are equal. | |
TestBase:: |
protected | function | Check to see if a value is false (an empty string, 0, NULL, or FALSE). | |
TestBase:: |
protected | function | Check to see if two values are identical. | |
TestBase:: |
protected | function | Checks to see if two objects are identical. | |
TestBase:: |
protected | function | Check to see if two values are not equal. | |
TestBase:: |
protected | function | Check to see if two values are not identical. | |
TestBase:: |
protected | function | Check to see if a value is not NULL. | |
TestBase:: |
protected | function | Check to see if a value is NULL. | |
TestBase:: |
protected | function | Check to see if a value is not false (not an empty string, 0, NULL, or FALSE). | |
TestBase:: |
protected | function | Changes the database connection to the prefixed one. | |
TestBase:: |
protected | function | Checks the matching requirements for Test. | 4 |
TestBase:: |
public | function | Returns a ConfigImporter object to import test importing of configuration. | 1 |
TestBase:: |
public | function | Copies configuration objects from source storage to target storage. | |
TestBase:: |
public static | function | Delete an assertion record by message ID. | |
TestBase:: |
protected | function | Fire an error assertion. | 1 |
TestBase:: |
public | function | Handle errors during test runs. | |
TestBase:: |
protected | function | Handle exceptions. | |
TestBase:: |
protected | function | Fire an assertion that is always negative. | |
TestBase:: |
public static | function | Ensures test files are deletable within file_unmanaged_delete_recursive(). | |
TestBase:: |
public static | function | Converts a list of possible parameters into a stack of permutations. | |
TestBase:: |
protected | function | Cycles through backtrace until the first non-assertion method is found. | |
TestBase:: |
public static | function | Returns the database connection to the site running Simpletest. | |
TestBase:: |
public static | function | Store an assertion from outside the testing context. | |
TestBase:: |
protected | function | Fire an assertion that is always positive. | |
TestBase:: |
protected | function | Create and set new configuration directories. | 1 |
TestBase:: |
protected | function | Generates a database prefix for running tests. | |
TestBase:: |
protected | function | Prepares the current environment for running the test. | |
TestBase:: |
public static | function | Generates a random string containing letters and numbers. | |
TestBase:: |
public static | function | Generates a random PHP object. | |
TestBase:: |
public static | function | Generates a random string of ASCII characters of codes 32 to 126. | |
TestBase:: |
protected | function | Rebuild drupal_container(). | 1 |
TestBase:: |
public | function | Run all tests in this class. | |
TestBase:: |
protected | function | Changes in memory settings. | |
TestBase:: |
protected | function | Logs verbose message in a text file. | |
UnitTestBase:: |
protected | property |