You are here

class PackageManagementTest in MongoDB 7

Same name in this branch
  1. 7 src/Tests/PackageManagementTest.php \Drupal\mongodb\Tests\PackageManagementTest
  2. 7 mongodb_watchdog/src/Tests/PackageManagementTest.php \Drupal\mongodb_watchdog\Tests\PackageManagementTest

Test package management hooks.

This test is about install/enable/disable/uninstall operations.

@group MongoDB: Base

Hierarchy

Expanded class hierarchy of PackageManagementTest

File

src/Tests/PackageManagementTest.php, line 12

Namespace

Drupal\mongodb\Tests
View source
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.');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PackageManagementTest::getInfo public static function
PackageManagementTest::MODULE constant
PackageManagementTest::setUp public function
PackageManagementTest::tearDown public function
PackageManagementTest::testEnable public function Test successful execution of hook_requirements() during install/enable.