summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2013-03-09 22:46:19 (GMT)
committerwebchick2013-03-09 22:46:19 (GMT)
commit6ba3cb12c1bb0a8ff65d691c89310a068e1f76aa (patch)
tree37936353c5ec9f6b277ef230bfcad90151aafd50
parent26c13e7916b71f792680ee352ab2443e7ee8aa74 (diff)
Issue #1937212 by ACF: Change node test variables 'node_test_change_view_mode()' and 'node_access_test_secret_catalan()' to the state system.
-rw-r--r--core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php2
-rw-r--r--core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php2
-rw-r--r--core/modules/node/tests/modules/node_access_test/node_access_test.module3
-rw-r--r--core/modules/node/tests/modules/node_test/node_test.module3
4 files changed, 6 insertions, 4 deletions
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php
index 6ff6ae0..85fcafc 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php
@@ -80,7 +80,7 @@ class NodeAccessLanguageTest extends NodeTestBase {
// Reset the node access cache and turn on our test node_access() code.
drupal_static_reset('node_access');
- variable_set('node_access_test_secret_catalan', 1);
+ state()->set('node_access_test_secret_catalan', 1);
// Tests that Hungarian is still accessible.
$this->assertNodeAccess($expected_node_access, $node, $web_user, 'hu');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
index b66944a..f072254 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
@@ -43,7 +43,7 @@ class NodeEntityViewModeAlterTest extends NodeTestBase {
$node = $this->drupalGetNodeByTitle($edit["title"]);
// Set the flag to alter the view mode and view the node.
- variable_set('node_test_change_view_mode', 'teaser');
+ state()->set('node_test_change_view_mode', 'teaser');
$this->drupalGet('node/' . $node->nid);
// Check that teaser mode is viewed.
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index 4efee88..493b486 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -241,7 +241,8 @@ function _node_access_test_node_write(Node $node) {
* Implements hook_node_access().
*/
function node_access_test_node_access($node, $op, $account, $langcode) {
- if (variable_get('node_access_test_secret_catalan', 0) && $langcode == 'ca') {
+ $secret_catalan = state()->get('node_access_test_secret_catalan') ?: 0;
+ if ($secret_catalan && $langcode == 'ca') {
// Make all Catalan content secret.
return NODE_ACCESS_DENY;
}
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index 36b59c9..6fdb3c5 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -160,7 +160,8 @@ function node_test_node_update(Node $node) {
*/
function node_test_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) {
// Only alter the view mode if we are on the test callback.
- if ($change_view_mode = variable_get('node_test_change_view_mode', '')) {
+ $change_view_mode = state()->get( 'node_test_change_view_mode') ?: '';
+ if ($change_view_mode) {
$view_mode = $change_view_mode;
}
}