diff -u b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php --- b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php @@ -80,82 +80,80 @@ // 4. One public with only the Catalan translation private. // 5. One public with both the Hungarian and Catalan translations private. // 6. One private with both the Hungarian and Catalan translations private. - $this->nodes['public_both_public'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $this->nodes['public_both_public'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 0)), - 'ca' => array(0 => array('value' => 0)), - ), - 'private' => FALSE, - )); - $this->nodes['private_both_public'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), - 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 0)), - 'ca' => array(0 => array('value' => 0)), - ), + 'field_private' => array(array('value' => 0)), + 'private' => FALSE, + )); + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 0; + $node->save(); + + $this->nodes['private_both_public'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), + 'langcode' => 'hu', + 'field_private' => array(array('value' => 0)), 'private' => TRUE, )); - $this->nodes['public_hu_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 0; + $node->save(); + + $this->nodes['public_hu_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 1)), - 'ca' => array(0 => array('value' => 0)), - ), + 'field_private' => array(array('value' => 1)), 'private' => FALSE, )); - $this->nodes['public_ca_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 0; + $node->save(); + + $this->nodes['public_ca_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 0)), - 'ca' => array(0 => array('value' => 1)), - ), + 'field_private' => array(array('value' => 0)), 'private' => FALSE, )); - $this->nodes['public_both_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 1; + $node->save(); + + $this->nodes['public_both_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 1)), - 'ca' => array(0 => array('value' => 1)), - ), + 'field_private' => array(array('value' => 1)), 'private' => FALSE, )); - $this->nodes['private_both_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 1; + $node->save(); + + $this->nodes['private_both_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 1)), - 'ca' => array(0 => array('value' => 1)), - ), + 'field_private' => array(array('value' => 1)), 'private' => TRUE, )); + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 1; + $node->save(); + $this->nodes['public_no_language_private'] = $this->drupalCreateNode(array( - 'field_private' => array( - 'und' => array(0 => array('value' => 1)), - ), + 'field_private' => array(array('value' => 1)), 'private' => FALSE, )); $this->nodes['public_no_language_public'] = $this->drupalCreateNode(array( - 'field_private' => array( - 'und' => array(0 => array('value' => 0)), - ), + 'field_private' => array(array('value' => 0)), 'private' => FALSE, )); $this->nodes['private_no_language_private'] = $this->drupalCreateNode(array( - 'field_private' => array( - 'und' => array(0 => array('value' => 1)), - ), + 'field_private' => array(array('value' => 1)), 'private' => TRUE, )); $this->nodes['private_no_language_public'] = $this->drupalCreateNode(array( - 'field_private' => array( - 'und' => array(0 => array('value' => 1)), - ), + 'field_private' => array(array('value' => 1)), 'private' => TRUE, )); } diff -u b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php --- b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php @@ -77,47 +77,47 @@ // 2. Two nodes with no language specified. // - One public. // - One private. - $this->nodes['both_public'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $this->nodes['both_public'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 0)), - 'ca' => array(0 => array('value' => 0)), - ) + 'field_private' => array(array('value' => 0)), )); - $this->nodes['ca_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 0; + $node->save(); + + $this->nodes['ca_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 0)), - 'ca' => array(0 => array('value' => 1)), - ) + 'field_private' => array(array('value' => 0)), )); - $this->nodes['hu_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 1; + $node->save(); + + $this->nodes['hu_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 1)), - 'ca' => array(0 => array('value' => 0)), - ) + 'field_private' => array(array('value' => 1)), )); - $this->nodes['both_private'] = $this->drupalCreateNode(array( - 'body' => array('hu' => array(array())), + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 0; + $node->save(); + + $this->nodes['both_private'] = $node = $this->drupalCreateNode(array( + 'body' => array(array()), 'langcode' => 'hu', - 'field_private' => array( - 'hu' => array(0 => array('value' => 1)), - 'ca' => array(0 => array('value' => 1)), - ) + 'field_private' => array(array('value' => 1)), )); + $translation = $node->getTranslation('ca'); + $translation->field_private[0]->value = 1; + $node->save(); + $this->nodes['no_language_public'] = $this->drupalCreateNode(array( - 'field_private' => array( - 'und' => array(0 => array('value' => 0)), - ) + 'field_private' => array(array('value' => 0)), )); $this->nodes['no_language_private'] = $this->drupalCreateNode(array( - 'field_private' => array( - 'und' => array(0 => array('value' => 1)), - ) + 'field_private' => array(array('value' => 1)), )); } diff -u b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php --- b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php @@ -60,7 +60,7 @@ // Creating a public node with langcode Hungarian, will be saved as // the fallback in node access table. - $node_public = $this->drupalCreateNode(array('body' => array('hu' => array(array())), 'langcode' => 'hu', 'private' => FALSE)); + $node_public = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'private' => FALSE)); $this->assertTrue($node_public->langcode == 'hu', 'Node created as Hungarian.'); // Tests the default access is provided for the public Hungarian node. @@ -119,7 +119,7 @@ // Creating a private node with langcode Hungarian, will be saved as // the fallback in node access table. - $node_public = $this->drupalCreateNode(array('body' => array('hu' => array(array())), 'langcode' => 'hu', 'private' => TRUE)); + $node_public = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'private' => TRUE)); $this->assertTrue($node_public->langcode == 'hu', 'Node created as Hungarian.'); // Tests the default access is not provided for the private Hungarian node. @@ -177,12 +177,12 @@ // Creating a private node with langcode Hungarian, will be saved as // the fallback in node access table. - $node_private = $this->drupalCreateNode(array('body' => array('hu' => array(array())), 'langcode' => 'hu', 'private' => TRUE)); + $node_private = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'private' => TRUE)); $this->assertTrue($node_private->langcode == 'hu', 'Node created as Hungarian.'); // Creating a public node with langcode Hungarian, will be saved as // the fallback in node access table. - $node_public = $this->drupalCreateNode(array('body' => array('hu' => array(array())), 'langcode' => 'hu', 'private' => FALSE)); + $node_public = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'private' => FALSE)); $this->assertTrue($node_public->langcode == 'hu', 'Node created as Hungarian.'); // Creating a public node with no special langcode, like when no language reverted: --- b/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.info +++ /dev/null @@ -1,7 +0,0 @@ -name = "Node module access tests language" -description = "Support module for language-aware node access testing." -package = Testing -version = VERSION -core = 8.x -dependencies[] = options -hidden = TRUE diff -u b/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.module b/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.module --- b/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.module +++ b/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.module @@ -8,7 +8,7 @@ * of the node to be marked as private (viewable only by administrators). */ -use Drupal\node\Plugin\Core\Entity\Node; +use Drupal\Core\Entity\EntityInterface; /** * Implements hook_node_grants(). @@ -23,7 +23,7 @@ /** * Implements hook_node_access_records(). */ -function node_access_test_language_node_access_records(Node $node) { +function node_access_test_language_node_access_records(EntityInterface $node) { $grants = array(); // Create grants for each translation of the node. only in patch2: unchanged: --- /dev/null +++ b/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.info.yml @@ -0,0 +1,8 @@ +name: 'Node module access tests language' +description: 'Support module for language-aware node access testing.' +package: Testing +version: VERSION +core: 8.x +dependencies: +- options +hidden: true