class TestDrupal6SqlBase

Same name and namespace in other branches
  1. 10 core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\d6\TestDrupal6SqlBase
  2. 11.x core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\d6\TestDrupal6SqlBase
  3. 8.9.x core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\d6\TestDrupal6SqlBase

Extends the Drupal6SqlBase abstract class.

Hierarchy

Expanded class hierarchy of TestDrupal6SqlBase

File

core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php, line 142

Namespace

Drupal\Tests\migrate_drupal\Unit\source\d6
View source
class TestDrupal6SqlBase extends DrupalSqlBase {
  
  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'filename' => $this->t('The path of the primary file for this item.'),
      'name' => $this->t('The name of the item; e.g. node.'),
      'type' => $this->t('The type of the item, either module, theme, or theme_engine.'),
      'owner' => $this->t("A theme's 'parent'. Can be either a theme or an engine."),
      'status' => $this->t('Boolean indicating whether or not this item is enabled.'),
      'throttle' => $this->t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'),
      'bootstrap' => $this->t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."),
      'schema_version' => $this->t("The module's database schema version number."),
      'weight' => $this->t("The order in which this module's hooks should be invoked."),
      'info' => $this->t("A serialized array containing information from the module's .info file."),
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->database
      ->select('system', 's')
      ->fields('s', [
      'filename',
      'name',
      'schema_version',
    ]);
    return $query;
  }
  
  /**
   * Tweaks Drupal6SqlBase to set a new database connection for tests.
   *
   * @param \Drupal\Core\Database\Connection $database
   *   The new connection to use.
   *
   * @see \Drupal\Tests\migrate\Unit\MigrateSqlTestCase
   */
  public function setDatabase(Connection $database) {
    $this->database = $database;
  }
  
  /**
   * Tweaks Drupal6SqlBase to set a new module handler for tests.
   *
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The new module handler to use.
   *
   * @see \Drupal\Tests\migrate\Unit\MigrateSqlTestCase
   */
  public function setModuleHandler(ModuleHandlerInterface $module_handler) {
    $this->moduleHandler = $module_handler;
  }
  
  /**
   * Wrapper method to test protected method moduleExists().
   */
  public function moduleExistsWrapper($module) {
    return parent::moduleExists($module);
  }
  
  /**
   * Wrapper method to test protected method getModuleSchemaVersion().
   */
  public function getModuleSchemaVersionWrapper($module) {
    return parent::getModuleSchemaVersion($module);
  }
  
  /**
   * Wrapper method to test protected method variableGet().
   */
  public function variableGetWrapper($name, $default) {
    return parent::variableGet($name, $default);
  }
  
  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [];
  }

}

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