Subissue of #1787218: Convert testing variables to state system..
Change the state variables:
front_page_output
image_test_results
path_test_results
simpletest_bootstrap_variable_test
test_module_enable_order
test_verbose_module_hooks
to the state system.

Files: 
CommentFileSizeAuthor
#6 1848058-system_to_state-drupal8-6.patch8.93 KBACF
PASSED: [[SimpleTest]]: [MySQL] 48,797 pass(es).
[ View ]
#4 1848058-system_to_state-drupal8-4.patch9.36 KBACF
FAILED: [[SimpleTest]]: [MySQL] 48,672 pass(es), 24 fail(s), and 0 exception(s).
[ View ]
#1 1848058-system_to_state-drupal8-1.patch11.42 KBACF
Test request sent.
[ View ]

Comments

StatusFileSize
new11.42 KB
Test request sent.
[ View ]

Patch attached.

Status:Active» Needs review

Status:Needs review» Needs work

+++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/VariableTest.phpundefined
@@ -35,8 +35,8 @@ public static function getInfo() {
-    variable_set('simpletest_bootstrap_variable_test', $variable);
-    $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), 'Setting and retrieving values');
+    state()->set('system_test.bootstrap_variable_test', $variable);
+    $this->assertIdentical($variable, state()->get('system_test.bootstrap_variable_test'), 'Setting and retrieving values');
@@ -44,8 +44,8 @@ function testVariable() {
-    variable_del('simpletest_bootstrap_variable_test');
-    $variable = variable_get('simpletest_bootstrap_variable_test', $default_value);
+    state()->delete('system_test.bootstrap_variable_test');
+    $variable = state()->get('system_test.bootstrap_variable_test', $default_value);
     $this->assertIdentical($variable, $default_value, 'Deleting variables');
@@ -54,10 +54,10 @@ function testVariable() {
-    $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), 'Variables are correctly defaulting to NULL.');
+    $this->assertIdentical(NULL, state()->get('system_test.bootstrap_variable_test'), 'Variables are correctly defaulting to NULL.');
     // Tests passing 5 to the default parameter.
-    $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), 'The default variable parameter is passed through correctly.');
+    $this->assertIdentical(5, state()->get('system_test.bootstrap_variable_test') ?: 5, 'The default variable parameter is passed through correctly.');

We shouldn't actually convert the variable tests. These are specifically to test the variable system and make no sense if converted to the state system. If the variable system does get removed we'll just delete all these tests. I'll remove these from the meta-issue.

+++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.phpundefined
@@ -157,7 +157,7 @@ function testModuleEnableOrder() {
-    $this->assertIdentical(variable_get('test_module_enable_order', array()), $expected_order);
+    $this->assertIdentical(state()->get('system_test.module_enable_order'), $expected_order);

All implementations of state()->get() in this patch need to specify a default by doing something along the lines of state()->get('system_test.module_enable_order') ?: array()

+++ b/core/modules/system/tests/modules/system_test/system_test.moduleundefined
@@ -58,8 +58,8 @@ function system_test_menu() {
-    'page callback' => 'variable_get',
-    'page arguments' => array('simpletest_bootstrap_variable_test', NULL),
+    'page callback' => 'state()->get',
+    'page arguments' => array('system_test.bootstrap_variable_test'),

Don't worry about this because state()->get() already returns NULL when the key doesn't exist.

Status:Needs work» Needs review
StatusFileSize
new9.36 KB
FAILED: [[SimpleTest]]: [MySQL] 48,672 pass(es), 24 fail(s), and 0 exception(s).
[ View ]

Removed the changes to variable.test and added the defaults.

Status:Needs review» Needs work

The last submitted patch, 1848058-system_to_state-drupal8-4.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new8.93 KB
PASSED: [[SimpleTest]]: [MySQL] 48,797 pass(es).
[ View ]

Remove last link to variable test.

Status:Needs review» Reviewed & tested by the community

Looks great passes tests

Category:feature» task
Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

added issue number