diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php index b284d96..0a6a58b 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeEntityFieldQueryAlterTest.php @@ -62,20 +62,4 @@ function setUp() { $this->noAccessUser = $this->drupalCreateUser(array('access content')); } - /** - * Tests that node access permissions are followed. - */ - function testNodeQueryAlterWithUI() { - // Verify that a user with access permission can see at least one node. - $this->drupalLogin($this->accessUser); - $this->drupalGet('node_access_entity_test_page'); - $this->assertText('Yes, 4 nodes', "4 nodes were found for access user"); - $this->assertNoText('Exception', "No database exception"); - - // Verify that a user with no access permission cannot see nodes. - $this->drupalLogin($this->noAccessUser); - $this->drupalGet('node_access_entity_test_page'); - $this->assertText('No nodes', "No nodes were found for no access user"); - $this->assertNoText('Exception', "No database exception"); - } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php index f2b241a..2caeca9 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php @@ -56,31 +56,6 @@ function setUp() { } /** - * Tests that node access permissions are followed. - */ - function testNodeQueryAlterWithUI() { - // Verify that a user with access permission can see at least one node. - $this->drupalLogin($this->accessUser); - $this->drupalGet('node_access_test_page'); - $this->assertText('Yes, 4 nodes', "4 nodes were found for access user"); - $this->assertNoText('Exception', "No database exception"); - - // Test the content overview page. - $this->drupalGet('admin/content'); - $table_rows = $this->xpath('//tbody/tr'); - $this->assertEqual(4, count($table_rows), "4 nodes were found for access user"); - - // Verify that a user with no access permission cannot see nodes. - $this->drupalLogin($this->noAccessUser); - $this->drupalGet('node_access_test_page'); - $this->assertText('No nodes', "No nodes were found for no access user"); - $this->assertNoText('Exception', "No database exception"); - - $this->drupalGet('admin/content'); - $this->assertText(t('No content available.')); - } - - /** * Tests 'node_access' query alter, for user with access. * * Verifies that a non-standard table alias can be used, and that a user with 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 ac25cb2..8299456 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 @@ -77,107 +77,6 @@ function node_access_test_permission() { } /** - * Implements hook_menu(). - * - * Sets up a test page that lists nodes. - */ -function node_access_test_menu() { - $items = array(); - $items['node_access_test_page'] = array( - 'title' => 'Node access test', - 'page callback' => 'node_access_test_page', - 'access arguments' => array('access content'), - 'type' => MENU_SUGGESTED_ITEM, - ); - $items['node_access_entity_test_page'] = array( - 'title' => 'Node access test', - 'page callback' => 'node_access_entity_test_page', - 'access arguments' => array('access content'), - 'type' => MENU_SUGGESTED_ITEM, - ); - return $items; -} - -/** - * Page callback: Creates the node access test page. - * - * Page should say "No nodes" if there are no nodes, and "Yes, # nodes" (with - * the number filled in) if there were nodes the user could access. Also, the - * database query is shown, and a list of the node IDs, for debugging purposes. - * And if there is a query exception, the page says "Exception" and gives the - * error. - * - * @see node_access_test_menu() - */ -function node_access_test_page() { - $output = ''; - - try { - $query = db_select('node', 'mytab') - ->fields('mytab'); - $query->addTag('node_access'); - $result = $query->execute()->fetchAll(); - - if (count($result)) { - $output .= '

Yes, ' . count($result) . ' nodes

'; - $output .= ''; - } - else { - $output .= '

No nodes

'; - } - - $output .= '

' . ((string) $query ) . '

'; - } - catch (Exception $e) { - $output = '

Exception

'; - $output .= '

' . $e->getMessage() . '

'; - } - - return $output; -} - -/** - * Page callback: Creates the node access entity test page. - * - * Page should say "No nodes" if there are no nodes, and "Yes, # nodes" (with - * the number filled in) if there were nodes the user could access. Also, the - * database query is shown, and a list of the node IDs, for debugging purposes. - * And if there is a query exception, the page says "Exception" and gives the - * error. - * - * @see node_access_test_menu() - */ -function node_access_entity_test_page() { - $output = ''; - try { - $result = Drupal::entityQuery('node') - ->condition('body.value', 'A', 'STARTS_WITH') - ->execute(); - if (!empty($result)) { - $output .= '

Yes, ' . count($result) . ' nodes

'; - $output .= ''; - } - else { - $output .= '

No nodes

'; - } - } - catch (Exception $e) { - $output = '

Exception

'; - $output .= '

' . $e->getMessage() . '

'; - } - - return $output; -} - -/** * Implements hook_form_BASE_FORM_ID_alter(). */ function node_access_test_form_node_form_alter(&$form, $form_state) {