You are here

PackageManagementTest.php in MongoDB 7

File

src/Tests/PackageManagementTest.php
View source
<?php

namespace Drupal\mongodb\Tests;


/**
 * Test package management hooks.
 *
 * This test is about install/enable/disable/uninstall operations.
 *
 * @group MongoDB: Base
 */
class PackageManagementTest extends \DrupalWebTestCase {
  const MODULE = 'mongodb';

  /**
   * {@inheritdoc}
   */
  public static function getInfo() {
    return array(
      'name' => 'MongoDB package management test',
      'description' => 'install/enable/disable/uninstall operations.',
      'group' => 'MongoDB: Base',
    );
  }

  /**
   * {@inheritdoc}
   */
  public function setUp() {

    // Support using the MongoDB cache.
    drupal_flush_all_caches();
    parent::setUp();
  }

  /**
   * {@inheritdoc}
   */
  public function tearDown() {

    // Support using the MongoDB cache.
    drupal_flush_all_caches();
    parent::tearDown();
  }

  /**
   * Test successful execution of hook_requirements() during install/enable.
   *
   * Function module_enable() does not check requirements, unlike normal
   * enabling, so we need to invoke the hook manually to simulate it.
   */
  public function testEnable() {
    module_load_install(static::MODULE);
    module_invoke(static::MODULE, 'requirements', 'install');
    module_enable([
      static::MODULE,
    ], FALSE);
    $this
      ->pass('Successfully enabled mongodb.module.');
  }

}

Classes

Namesort descending Description
PackageManagementTest Test package management hooks.