PackageManagementTest.php in MongoDB 7
File
mongodb_watchdog/src/Tests/PackageManagementTest.php
View source
<?php
namespace Drupal\mongodb_watchdog\Tests;
class PackageManagementTest extends \DrupalWebTestCase {
const MODULE = 'mongodb_watchdog';
const DRIVER = 'mongodb';
protected $profile = 'testing';
public static function getInfo() {
return array(
'name' => 'MongoDB watchdog package management test',
'description' => 'install/enable/disable/uninstall operations.',
'group' => 'MongoDB: Watchdog',
);
}
public function setUp() {
drupal_flush_all_caches();
parent::setUp();
}
public function tearDown() {
drupal_flush_all_caches();
parent::tearDown();
}
public function testUninstall() {
module_enable([
static::DRIVER,
static::MODULE,
]);
$this
->pass('Successfully enabled driver and watchdog.module.');
module_disable([
static::MODULE,
static::DRIVER,
]);
$admin = $this
->drupalCreateUser([
'administer modules',
]);
$this
->drupalLogin($admin);
$modules = [
'uninstall[mongodb_watchdog]' => 1,
];
$this
->drupalPost('admin/modules/uninstall', $modules, t('Uninstall'));
$this
->assertResponse(200, 'Module uninstall form succeeded');
$this
->drupalPost(NULL, [], t('Uninstall'));
$this
->assertText(t('The selected modules have been uninstalled.'), 'Module uninstall confirmation succeeded.');
$this
->pass('Successfully uninstalled watchdog module.');
}
}