module_test.install

Same filename in other branches
  1. 9 core/modules/system/tests/modules/module_test/module_test.install
  2. 8.9.x core/modules/system/tests/modules/module_test/module_test.install
  3. 10 core/modules/system/tests/modules/module_test/module_test.install
  4. 11.x core/modules/system/tests/modules/module_test/module_test.install

Install, update and uninstall functions for the module_test module.

File

modules/simpletest/tests/module_test.install

View source
<?php


/**
 * @file
 * Install, update and uninstall functions for the module_test module.
 */

/**
 * Implements hook_schema().
 */
function module_test_schema() {
    $schema['module_test'] = array(
        'description' => 'Dummy table to test the behavior of hook_schema() during module installation.',
        'fields' => array(
            'data' => array(
                'type' => 'varchar',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
                'description' => 'An example data column for the module.',
            ),
        ),
    );
    return $schema;
}

/**
 * Implements hook_install().
 */
function module_test_install() {
    $record = array(
        'data' => 'Data inserted in hook_install()',
    );
    drupal_write_record('module_test', $record);
}

/**
 * Implements hook_enable().
 */
function module_test_enable() {
    $record = array(
        'data' => 'Data inserted in hook_enable()',
    );
    drupal_write_record('module_test', $record);
}

Functions

Title Deprecated Summary
module_test_enable Implements hook_enable().
module_test_install Implements hook_install().
module_test_schema Implements hook_schema().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.