diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php index beb97bf..d8c0694 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareCombinationTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\node\Tests\NodeAccessLanguageAwareCombinationTest. + * Contains Drupal\node\Tests\NodeAccessLanguageAwareCombinationTest. */ namespace Drupal\node\Tests; @@ -23,7 +23,7 @@ class NodeAccessLanguageAwareCombinationTest extends NodeTestBase { public static function getInfo() { return array( - 'name' => 'Node access language aware combination', + 'name' => 'Node access language-aware combination', 'description' => 'Tests node access functionality with multiple languages and two node access modules.', 'group' => 'Node', ); @@ -59,9 +59,9 @@ function testNodeAccessLanguageAwareCombination() { $expected_node_access = array('view' => TRUE, 'update' => FALSE, 'delete' => FALSE); $expected_node_access_no_access = array('view' => FALSE, 'update' => FALSE, 'delete' => FALSE); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is public, Catalan is public, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is public, Catalan is public, non-language-aware + // node access module public. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -71,18 +71,18 @@ function testNodeAccessLanguageAwareCombination() { ), 'private' => FALSE, )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); $this->assertNodeAccess($expected_node_access, $node, $web_user); $this->assertNodeAccess($expected_node_access, $node, $web_user, 'hu'); $this->assertNodeAccess($expected_node_access, $node, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is public, Catalan is public, non language aware - // node_access module private. - // Even the non language aware node_access module (private) prevents access, - // still the settings of the language aware module (field_private) will + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is public, Catalan is public, non-language-aware + // node access module private. + // Even the non-language-aware node access module (private) prevents access, + // still the settings of the language-aware module (field_private) will // be used. Because it generates grants also when access is granted. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -93,19 +93,19 @@ function testNodeAccessLanguageAwareCombination() { ), 'private' => TRUE, )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); - // language aware node_access module Mmdule specificly grants access to - // languages versions of nodes. That is why non language aware node_access - // module cannot prevent access from it. + // The language-aware node access module specifically grants access to + // specific language versions of nodes, so the non-language-aware node + // access module cannot prevent access to it. $this->assertNodeAccess($expected_node_access, $node, $web_user); $this->assertNodeAccess($expected_node_access, $node, $web_user, 'hu'); $this->assertNodeAccess($expected_node_access, $node, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is private, Catalan is public, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is private, Catalan is public, non-language-aware + // node access module public. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -115,16 +115,16 @@ function testNodeAccessLanguageAwareCombination() { ), 'private' => FALSE, )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'hu'); $this->assertNodeAccess($expected_node_access, $node, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is public, Catalan is private, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is public, Catalan is private, non-language-aware + // node access module public. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -134,16 +134,16 @@ function testNodeAccessLanguageAwareCombination() { ), 'private' => FALSE, )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); $this->assertNodeAccess($expected_node_access, $node, $web_user); $this->assertNodeAccess($expected_node_access, $node, $web_user, 'hu'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is private, Catalan is private, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is private, Catalan is private, non-language-aware + // node access module public. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -153,16 +153,16 @@ function testNodeAccessLanguageAwareCombination() { ), 'private' => FALSE, )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'hu'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is private, Catalan is private, non language aware - // node_access module private. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is private, Catalan is private, non-language-aware + // node access module private. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -172,7 +172,7 @@ function testNodeAccessLanguageAwareCombination() { ), 'private' => TRUE, )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user); $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'hu'); @@ -187,9 +187,9 @@ function testNodeAccessLanguageAwareCombination() { function testNodeAccessLanguageAwareQueryTag() { $web_user = $this->drupalCreateUser(array('access content')); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is public, Catalan is public, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is public, Catalan is public, non-language-aware + // node access module public. $node_both_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -200,11 +200,11 @@ function testNodeAccessLanguageAwareQueryTag() { 'private' => FALSE, )); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is public, Catalan is public, non language aware - // node_access module private. - // Even the non language aware node_access module (private) prevents access, - // still the settings of the language aware module (field_private) will + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is public, Catalan is public, non-language-aware + // node access module private. + // Even the non-language-aware node access module (private) prevents access, + // still the settings of the language-aware module (field_private) will // be used. Because it generates grants also when access is granted. $node_both_public_non_language_aware_private = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -216,9 +216,9 @@ function testNodeAccessLanguageAwareQueryTag() { 'private' => TRUE, )); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is private, Catalan is public, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is private, Catalan is public, non-language-aware + // node access module public. $node_only_hu_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -229,9 +229,9 @@ function testNodeAccessLanguageAwareQueryTag() { 'private' => FALSE, )); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is public, Catalan is private, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is public, Catalan is private, non-language-aware + // node access module public. $node_only_ca_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -242,12 +242,12 @@ function testNodeAccessLanguageAwareQueryTag() { 'private' => FALSE, )); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is private, Catalan is private, non language aware - // node_access module public. - // Even the non language aware node_access module (private) grants access, - // still the settings of the language aware module (field_private) will - // be used. Because the non language aware node_access module (private) + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is private, Catalan is private, non-language-aware + // node access module public. + // Even the non-language-aware node access module (private) grants access, + // still the settings of the language-aware module (field_private) will + // be used. Because the non-language-aware node access module (private) // does only create grants when it is settings is private. $node_no_public_non_language_aware_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -259,9 +259,9 @@ function testNodeAccessLanguageAwareQueryTag() { 'private' => FALSE, )); - // Creating a Node with default langcode Hungarian and translation Catalan. - // Hungarian language is private, Catalan is private, non language aware - // node_access module public. + // Creating a node with default langcode Hungarian and translation Catalan. + // Hungarian language is private, Catalan is private, non-language-aware + // node access module public. $node_no_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), 'langcode' => 'hu', @@ -272,7 +272,7 @@ function testNodeAccessLanguageAwareQueryTag() { 'private' => TRUE, )); - // Query the nodes table as readonly user with Node Access Tag and no + // Query the nodes table as the web user with the node access tag and no // specific langcode. $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -282,12 +282,12 @@ function testNodeAccessLanguageAwareQueryTag() { // Because no langcode is given it will use the fallback language // (which is hungarian). - $this->assertEqual(count($nids), 3, 'db_select returns 3 nodes'); + $this->assertEqual(count($nids), 3, 'db_select() returns 3 nodes.'); $this->assertTrue(array_key_exists($node_both_public->nid, $nids), 'Returned node ID is full public node.'); $this->assertTrue(array_key_exists($node_only_hu_public->nid, $nids), 'Returned node ID is Hungarian public only node.'); - $this->assertTrue(array_key_exists($node_both_public_non_language_aware_private->nid, $nids), 'Returned node ID is both public non language aware private only node.'); + $this->assertTrue(array_key_exists($node_both_public_non_language_aware_private->nid, $nids), 'Returned node ID is both public non-language-aware private only node.'); - // Query the nodes table as readonly user with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // Hungarian langcode $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -296,12 +296,12 @@ function testNodeAccessLanguageAwareQueryTag() { ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); - $this->assertEqual(count($nids), 3, 'db_select returns 3 nodes'); + $this->assertEqual(count($nids), 3, 'db_select() returns 3 nodes.'); $this->assertTrue(array_key_exists($node_both_public->nid, $nids), 'Returned node ID is both public node.'); $this->assertTrue(array_key_exists($node_only_hu_public->nid, $nids), 'Returned node ID is Hungarian public only node.'); - $this->assertTrue(array_key_exists($node_both_public_non_language_aware_private->nid, $nids), 'Returned node ID is both public non language aware private only node.'); + $this->assertTrue(array_key_exists($node_both_public_non_language_aware_private->nid, $nids), 'Returned node ID is both public non-language-aware private only node.'); - // Query the nodes table as readonly user with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // Catalan langcode $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -310,13 +310,13 @@ function testNodeAccessLanguageAwareQueryTag() { ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); - $this->assertEqual(count($nids), 3, 'db_select returns 3 nodes'); + $this->assertEqual(count($nids), 3, 'db_select() returns 3 nodes.'); $this->assertTrue(array_key_exists($node_both_public->nid, $nids), 'Returned node ID is both public node.'); $this->assertTrue(array_key_exists($node_only_ca_public->nid, $nids), 'Returned node ID is Catalan public only node.'); - $this->assertTrue(array_key_exists($node_both_public_non_language_aware_private->nid, $nids), 'Returned node ID is both public non language aware private only node.'); + $this->assertTrue(array_key_exists($node_both_public_non_language_aware_private->nid, $nids), 'Returned node ID is both public non-language-aware private only node.'); - // Query the nodes table as readonly User with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // langcode de. $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -325,22 +325,22 @@ function testNodeAccessLanguageAwareQueryTag() { ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); - // Because all created nodes are not in German, no Nodes are returned. - $this->assertTrue(empty($nids), 'db_select returns empty result'); + // Because all created nodes are not in German, no nodes are returned. + $this->assertTrue(empty($nids), 'db_select() returns an empty result.'); - // Query the nodes table as User 1 (full access) with Node Access Tag and no - // specific langcode. + // Query the nodes table as user 1 (full access) with the node access tag + // and no specific langcode. $select = db_select('node', 'n') ->fields('n', array('nid')) ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Both nodes are returned. - $this->assertEqual(count($nids), 6, 'db_select returns all nodes'); + $this->assertEqual(count($nids), 6, 'db_select() returns all nodes.'); - // Query the nodes table as User 1 (full access) with Node Access Tag and - // langcode de. + // Query the nodes table as user 1 (full access) with the node access tag + // and langcode de. $select = db_select('node', 'n') ->fields('n', array('nid')) ->addMetaData('langcode', 'de') @@ -349,7 +349,7 @@ function testNodeAccessLanguageAwareQueryTag() { // Both nodes are returned because node access tag is not invoked when // the user is user 1. - $this->assertEqual(count($nids), 6, 'db_select returns all nodes'); + $this->assertEqual(count($nids), 6, 'db_select() returns all nodes.'); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php index 46d200f..05ccf8f 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageAwareTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\node\Tests\NodeAccessLanguageAwareTest. + * Contains Drupal\node\Tests\NodeAccessLanguageAwareTest. */ namespace Drupal\node\Tests; @@ -23,8 +23,8 @@ class NodeAccessLanguageAwareTest extends NodeTestBase { public static function getInfo() { return array( - 'name' => 'Node access language aware', - 'description' => 'Test node_access and db_select with node_access tag functionality with multiple languages with node_access_test_language which is language aware.', + 'name' => 'Node access language-aware', + 'description' => 'Test node_access and db_select() with node_access tag functionality with multiple languages with node_access_test_language which is language-aware.', 'group' => 'Node', ); } @@ -60,7 +60,7 @@ function testNodeAccessLanguageAware() { $expected_node_access_no_access = array('view' => FALSE, 'update' => FALSE, 'delete' => FALSE); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is public, Catalan is public. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -70,7 +70,7 @@ function testNodeAccessLanguageAware() { 'ca' => array(0 => array('value' => 0)), ) )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); // Tests that access to default language (Hungarian) is granted. $this->assertNodeAccess($expected_node_access, $node, $web_user); @@ -84,7 +84,7 @@ function testNodeAccessLanguageAware() { // Tests that access to english language is granted. $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is private, Catalan is public. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -94,7 +94,7 @@ function testNodeAccessLanguageAware() { 'ca' => array(0 => array('value' => 0)), ) )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); // Tests that access to default language (Hungarian) is not granted. $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user); @@ -108,7 +108,7 @@ function testNodeAccessLanguageAware() { // Tests that access to english language is not granted. $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is public, Catalan is private. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -118,7 +118,7 @@ function testNodeAccessLanguageAware() { 'ca' => array(0 => array('value' => 1)), ) )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); // Tests that access to default language (Hungarian) is granted. $this->assertNodeAccess($expected_node_access, $node, $web_user); @@ -132,7 +132,7 @@ function testNodeAccessLanguageAware() { // Tests that access to english language is granted. $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user, 'en'); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is private, Catalan is private. $node = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -142,7 +142,7 @@ function testNodeAccessLanguageAware() { 'ca' => array(0 => array('value' => 1)), ) )); - $this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.')); + $this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.'); // Tests that access to default language (Hungarian) is not granted. $this->assertNodeAccess($expected_node_access_no_access, $node, $web_user); @@ -163,7 +163,7 @@ function testNodeAccessLanguageAware() { function testNodeAccessLanguageAwareQueryTag() { $web_user = $this->drupalCreateUser(array('access content')); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is public, Catalan is public. $node_both_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -174,7 +174,7 @@ function testNodeAccessLanguageAwareQueryTag() { ) )); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is private, Catalan is public. $node_only_hu_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -185,7 +185,7 @@ function testNodeAccessLanguageAwareQueryTag() { ) )); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is public, Catalan is private. $node_only_ca_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -196,7 +196,7 @@ function testNodeAccessLanguageAwareQueryTag() { ) )); - // Creating a Node with default langcode Hungarian and translation Catalan. + // Creating a node with default langcode Hungarian and translation Catalan. // Hungarian language is private, Catalan is private. $node_no_public = $this->drupalCreateNode(array( 'body' => array('hu' => array(array())), @@ -207,7 +207,7 @@ function testNodeAccessLanguageAwareQueryTag() { ) )); - // Query the nodes table as readonly user with Node Access Tag and no + // Query the nodes table as the web user with the node access tag and no // specific langcode. $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -217,11 +217,11 @@ function testNodeAccessLanguageAwareQueryTag() { // Because no langcode is given it will use the fallback language // (which is hungarian). - $this->assertEqual(count($nids), 2, 'db_select returns 2 nodes'); + $this->assertEqual(count($nids), 2, 'db_select() returns 2 nodes.'); $this->assertTrue(array_key_exists($node_both_public->nid, $nids), 'Returned node ID is full public node.'); $this->assertTrue(array_key_exists($node_only_hu_public->nid, $nids), 'Returned node ID is Hungarian public only node.'); - // Query the nodes table as readonly user with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // Hungarian langcode $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -231,11 +231,11 @@ function testNodeAccessLanguageAwareQueryTag() { $nids = $select->execute()->fetchAllAssoc('nid'); // Same nodes as witouth langcode should be returned. - $this->assertEqual(count($nids), 2, 'db_select returns 2 nodes'); + $this->assertEqual(count($nids), 2, 'db_select() returns 2 nodes.'); $this->assertTrue(array_key_exists($node_both_public->nid, $nids), 'Returned node ID is both public node.'); $this->assertTrue(array_key_exists($node_only_hu_public->nid, $nids), 'Returned node ID is Hungarian public only node.'); - // Query the nodes table as readonly user with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // Catalan langcode $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -245,12 +245,12 @@ function testNodeAccessLanguageAwareQueryTag() { $nids = $select->execute()->fetchAllAssoc('nid'); // Only the Catalan and the Full Public node should be returned. - $this->assertEqual(count($nids), 2, 'db_select returns 2 nodes'); + $this->assertEqual(count($nids), 2, 'db_select() returns 2 nodes.'); $this->assertTrue(array_key_exists($node_both_public->nid, $nids), 'Returned node ID is both public node.'); $this->assertTrue(array_key_exists($node_only_ca_public->nid, $nids), 'Returned node ID is Catalan public only node.'); - // Query the nodes table as readonly User with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // langcode de. $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -259,22 +259,22 @@ function testNodeAccessLanguageAwareQueryTag() { ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); - // Because all created nodes are not in German, no Nodes are returned. - $this->assertTrue(empty($nids), 'db_select returns empty result'); + // Because all created nodes are not in German, no nodes are returned. + $this->assertTrue(empty($nids), 'db_select() returns an empty result.'); - // Query the nodes table as User 1 (full access) with Node Access Tag and no - // specific langcode. + // Query the nodes table as user 1 (full access) with the node access tag + // and no specific langcode. $select = db_select('node', 'n') ->fields('n', array('nid')) ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Both nodes are returned. - $this->assertEqual(count($nids), 4, 'db_select returns all nodes'); + $this->assertEqual(count($nids), 4, 'db_select() returns all nodes.'); - // Query the nodes table as User 1 (full access) with Node Access Tag and - // langcode de. + // Query the nodes table as user 1 (full access) with the node access tag + // and langcode de. $select = db_select('node', 'n') ->fields('n', array('nid')) ->addMetaData('langcode', 'de') @@ -283,7 +283,7 @@ function testNodeAccessLanguageAwareQueryTag() { // Both nodes are returned because node access tag is not invoked when // the user is user 1. - $this->assertEqual(count($nids), 4, 'db_select returns all nodes'); + $this->assertEqual(count($nids), 4, 'db_select() returns all nodes.'); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php index f97a323..04f9f12 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php @@ -24,7 +24,7 @@ class NodeAccessLanguageTest extends NodeTestBase { public static function getInfo() { return array( 'name' => 'Node access language', - 'description' => 'Test node_access and db_select with node_access tag functionality with multiple languages with a test node access module that is not language-aware.', + 'description' => 'Test node_access and db_select() with node_access tag functionality with multiple languages with a test node access module that is not language-aware.', 'group' => 'Node', ); } @@ -62,7 +62,7 @@ function testNodeAccess() { $expected_node_access = array('view' => TRUE, 'update' => FALSE, 'delete' => FALSE); $expected_node_access_no_access = array('view' => FALSE, 'update' => FALSE, 'delete' => FALSE); - // Creating a public Node with langcode Hungarian, will be saved as + // 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)); $this->assertTrue($node_public->langcode == 'hu', 'Node created as Hungarian.'); @@ -79,7 +79,7 @@ function testNodeAccess() { $this->assertNodeAccess($expected_node_access_no_access, $node_public, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node_public, $web_user, 'hr'); - // Creating a public Node with no special langcode, like when no language + // Creating a public node with no special langcode, like when no language // Module enabled. $node_public_no_language = $this->drupalCreateNode(array('private' => FALSE)); $this->assertTrue($node_public_no_language->langcode == LANGUAGE_NOT_SPECIFIED, 'Node created with not specified language.'); @@ -119,7 +119,7 @@ function testNodeAccessPrivate() { $expected_node_access = array('view' => TRUE, 'update' => FALSE, 'delete' => FALSE); $expected_node_access_no_access = array('view' => FALSE, 'update' => FALSE, 'delete' => FALSE); - // Creating a private Node with langcode Hungarian, will be saved as + // 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)); $this->assertTrue($node_public->langcode == 'hu', 'Node created as Hungarian.'); @@ -136,7 +136,7 @@ function testNodeAccessPrivate() { $this->assertNodeAccess($expected_node_access_no_access, $node_public, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node_public, $web_user, 'hr'); - // Creating a private Node with no special langcode, like when no language + // Creating a private node with no special langcode, like when no language // Module enabled. $node_private_no_language = $this->drupalCreateNode(array('private' => TRUE)); $this->assertTrue($node_private_no_language->langcode == LANGUAGE_NOT_SPECIFIED, 'Node created with not specified language.'); @@ -173,22 +173,22 @@ function testNodeAccessPrivate() { function testNodeAccessQueryTag() { $web_user = $this->drupalCreateUser(array('access content')); - // Creating a private Node with langcode Hungarian, will be saved as + // 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)); $this->assertTrue($node_private->langcode == 'hu', 'Node created as Hungarian.'); - // Creating a public Node with langcode Hungarian, will be saved as + // 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)); $this->assertTrue($node_public->langcode == 'hu', 'Node created as Hungarian.'); - // Creating a public Node with no special langcode, like when no language + // Creating a public node with no special langcode, like when no language // Module enabled. $node_no_language = $this->drupalCreateNode(array('private' => FALSE)); $this->assertTrue($node_no_language->langcode == LANGUAGE_NOT_SPECIFIED, 'Node created with not specified language.'); - // Query the nodes table as readonly user with Node Access Tag and no + // Query the nodes table as the web user with the node access tag and no // specific langcode. $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -197,12 +197,12 @@ function testNodeAccessQueryTag() { $nids = $select->execute()->fetchAllAssoc('nid'); // The public node and no language node should be returned. Because no - // langcode is given itwill use the fallback node. - $this->assertEqual(count($nids), 2, 'db_select returns 2 node'); + // langcode is given it will use the fallback node. + $this->assertEqual(count($nids), 2, 'db_select() returns 2 node'); $this->assertTrue(array_key_exists($node_public->nid, $nids), 'Returned node ID is public node.'); $this->assertTrue(array_key_exists($node_no_language->nid, $nids), 'Returned node ID is no language node.'); - // Query the nodes table as readonly User with Node Access Tag and + // Query the nodes table as the web user with the node access tag and // langcode de. $select = db_select('node', 'n') ->fields('n', array('nid')) @@ -211,21 +211,21 @@ function testNodeAccessQueryTag() { ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); - // Because no Nodes are created in German, no Nodes are returned. - $this->assertTrue(empty($nids), 'db_select returns empty result'); + // Because no nodes are created in German, no nodes are returned. + $this->assertTrue(empty($nids), 'db_select() returns an empty result.'); - // Query the nodes table as User 1 (full access) with Node Access Tag and no - // specific langcode. + // Query the nodes table as user 1 (full access) with the node access tag + // and no specific langcode. $select = db_select('node', 'n') ->fields('n', array('nid')) ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // All nodes are returned. - $this->assertEqual(count($nids), 3, 'db_select returns all three nodes.'); + $this->assertEqual(count($nids), 3, 'db_select() returns all three nodes.'); - // Query the nodes table as User 1 (full access) with Node Access Tag and - // langcode de. + // Query the nodes table as user 1 (full access) with the node access tag + // and langcode de. $select = db_select('node', 'n') ->fields('n', array('nid')) ->addMetaData('langcode', 'de') @@ -234,7 +234,7 @@ function testNodeAccessQueryTag() { // All nodes are returned because node access tag is not invoked when // the user is user 1. - $this->assertEqual(count($nids), 3, 'db_select returns all three nodes.'); + $this->assertEqual(count($nids), 3, 'db_select() returns all three nodes.'); } }