diff --git a/core/modules/system/src/Tests/Module/InstallTest.php b/core/modules/system/src/Tests/Module/InstallKernelTest.php
similarity index 54%
copy from core/modules/system/src/Tests/Module/InstallTest.php
copy to core/modules/system/src/Tests/Module/InstallKernelTest.php
index 5f1a091..a451456 100644
--- a/core/modules/system/src/Tests/Module/InstallTest.php
+++ b/core/modules/system/src/Tests/Module/InstallKernelTest.php
@@ -8,29 +8,29 @@
namespace Drupal\system\Tests\Module;
use Drupal\Core\Extension\ExtensionNameLengthException;
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\KernelTestBase;
/**
* Tests the installation of modules.
*
* @group Module
*/
-class InstallTest extends WebTestBase {
+class InstallKernelTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
- public static $modules = array('module_test');
+ public static $modules = array('system', 'user', 'module_test');
/**
- * Verify that drupal_get_schema() can be used during module installation.
+ * {@inheritdoc}
*/
- public function testGetSchemaAtInstallTime() {
- // @see module_test_install()
- $value = db_query("SELECT data FROM {module_test}")->fetchField();
- $this->assertIdentical($value, 'varchar');
+ public function setUp() {
+ parent::setUp();
+ $this->installSchema('module_test', 'module_test');
+ $this->installSchema('user', 'users_data');
}
/**
@@ -43,31 +43,10 @@ public function testGetSchemaAtInstallTime() {
public function testEnableUserTwice() {
\Drupal::service('module_installer')->install(array('user'), FALSE);
$this->assertIdentical($this->config('core.extension')->get('module.user'), 0);
- }
-
- /**
- * Tests recorded schema versions of early installed modules in the installer.
- */
- public function testRequiredModuleSchemaVersions() {
- $version = drupal_get_installed_schema_version('system', TRUE);
- $this->assertTrue($version > 0, 'System module version is > 0.');
- $version = drupal_get_installed_schema_version('user', TRUE);
- $this->assertTrue($version > 0, 'User module version is > 0.');
-
- $post_update_key_value = \Drupal::keyValue('post_update');
- $existing_updates = $post_update_key_value->get('existing_updates', []);
- $this->assertTrue(in_array('module_test_post_update_test', $existing_updates));
- }
-
- /**
- * Ensures that post update functions are removed on uninstall.
- */
- public function testUninstallPostUpdateFunctions() {
- \Drupal::service('module_installer')->uninstall(['module_test']);
- $post_update_key_value = \Drupal::keyValue('post_update');
- $existing_updates = $post_update_key_value->get('existing_updates', []);
- $this->assertFalse(in_array('module_test_post_update_test', $existing_updates));
+ // To avoid false positives, ensure that a module that does not exist does
+ // not return exactly zero.
+ $this->assertNotIdentical($this->config('core.extension')->get('module.does_not_exist'), 0);
}
/**
diff --git a/core/modules/system/src/Tests/Module/InstallTest.php b/core/modules/system/src/Tests/Module/InstallTest.php
index 5f1a091..d4996c8 100644
--- a/core/modules/system/src/Tests/Module/InstallTest.php
+++ b/core/modules/system/src/Tests/Module/InstallTest.php
@@ -34,18 +34,6 @@ public function testGetSchemaAtInstallTime() {
}
/**
- * Tests enabling User module once more.
- *
- * Regression: The installer might enable a module twice due to automatic
- * dependency resolution. A bug caused the stored weight for User module to
- * be an array.
- */
- public function testEnableUserTwice() {
- \Drupal::service('module_installer')->install(array('user'), FALSE);
- $this->assertIdentical($this->config('core.extension')->get('module.user'), 0);
- }
-
- /**
* Tests recorded schema versions of early installed modules in the installer.
*/
public function testRequiredModuleSchemaVersions() {
@@ -63,36 +51,20 @@ public function testRequiredModuleSchemaVersions() {
* Ensures that post update functions are removed on uninstall.
*/
public function testUninstallPostUpdateFunctions() {
+ // First, to avoid false positives, ensure that the post_update function
+ // exists while the module is still installed.
+ $post_update_key_value = \Drupal::keyValue('post_update');
+ $existing_updates = $post_update_key_value->get('existing_updates', []);
+ $this->assertTrue(in_array('module_test_post_update_test', $existing_updates));
+
+ // Uninstall the module.
\Drupal::service('module_installer')->uninstall(['module_test']);
+
+ // Ensure the post update function is no longer listed.
$post_update_key_value = \Drupal::keyValue('post_update');
$existing_updates = $post_update_key_value->get('existing_updates', []);
$this->assertFalse(in_array('module_test_post_update_test', $existing_updates));
}
- /**
- * Tests that an exception is thrown when a module name is too long.
- */
- public function testModuleNameLength() {
- $module_name = 'invalid_module_name_over_the_maximum_allowed_character_length';
- $message = format_string('Exception thrown when enabling module %name with a name length over the allowed maximum', array('%name' => $module_name));
- try {
- $this->container->get('module_installer')->install(array($module_name));
- $this->fail($message);
- }
- catch (ExtensionNameLengthException $e) {
- $this->pass($message);
- }
-
- // Since for the UI, the submit callback uses FALSE, test that too.
- $message = format_string('Exception thrown when enabling as if via the UI the module %name with a name length over the allowed maximum', array('%name' => $module_name));
- try {
- $this->container->get('module_installer')->install(array($module_name), FALSE);
- $this->fail($message);
- }
- catch (ExtensionNameLengthException $e) {
- $this->pass($message);
- }
- }
-
}
diff --git a/sites/simpletest/.htaccess b/sites/simpletest/.htaccess
new file mode 100644
index 0000000..18a7257
--- /dev/null
+++ b/sites/simpletest/.htaccess
@@ -0,0 +1,14 @@
+# Turn off all options we don't need.
+Options -Indexes -ExecCGI -Includes -MultiViews
+
+# Set the catch-all handler to prevent scripts from being executed.
+SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
+
+ # Override the handler again if we're run later in the evaluation list.
+ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
+
+
+# If we know how to do it safely, disable the PHP engine entirely.
+
+ php_flag engine off
+
\ No newline at end of file