--- 1349080-143-d8-move-access-to-join-condition-update-test.patch 2013-11-13 09:07:21.005485061 +0100 +++ 1349080-148-d8-move-access-to-join-condition-update-test.patch 2013-11-13 13:34:49.455728719 +0100 @@ -65,10 +65,10 @@ * Writes a list of grants to the database, deleting previously saved ones. diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessSubqueryTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessSubqueryTest.php new file mode 100644 -index 0000000..31ef2b8 +index 0000000..8070e4d --- /dev/null +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessSubqueryTest.php -@@ -0,0 +1,204 @@ +@@ -0,0 +1,210 @@ +field_name = drupal_strtolower($this->randomName() . '_field_name'); -+ $this->field = field_create_field( -+ array( -+ 'field_name' => $this->field_name, -+ 'type' => 'number_integer', -+ 'cardinality' => FIELD_CARDINALITY_UNLIMITED -+ ) -+ ); ++ $this->field = entity_create('field_entity', array( ++ 'name' => $this->field_name, ++ 'entity_type' => 'node', ++ 'type' => 'number_integer', ++ 'cardinality' => FieldDefinitionInterface::CARDINALITY_UNLIMITED ++ )); ++ $this->field->save(); + $instance = array( + 'field_name' => $this->field_name, + 'entity_type' => 'node', + 'bundle' => 'page', + ); -+ $this->instance = field_create_instance($instance); ++ $this->instance = entity_create('field_instance', $instance)->save(); + } + + /** @@ -153,17 +157,19 @@ + */ + function testNodeAccessSubquery() { + // Create a page node. -+ $langcode = LANGUAGE_NOT_SPECIFIED; ++ $langcode = Language::LANGCODE_NOT_SPECIFIED; + $field_data = array(); -+ -+ $node1 = $this->drupalCreateNode(array('title'=>'Private node 1','private'=> TRUE, 'uid' => $this->admin_user->uid, 'status'=>0)); -+ -+ $value = $field_data[0]['value'] = $node1->nid; -+ $node2 = $this->drupalCreateNode(array('title' => 'Public node 2', $this->field_name => $field_data, 'private' => TRUE, 'uid' => $this->user->uid, 'status'=>1)); -+ $node3 = $this->drupalCreateNode(array('title' => 'Public node 3', 'private' => TRUE, 'uid' => $this->user->uid, 'status'=>1)); -+ $value2 = $field_data[0]['value'] = $node3->nid; -+ $node4 = $this->drupalCreateNode(array('title' => 'Public node 4', $this->field_name => $field_data, 'private' => TRUE, 'uid' => $this->user->uid, 'status'=>1)); -+ $node5 = $this->drupalCreateNode(array('title' => 'Public node 5', 'uid' => $this->user->uid, 'private' => FALSE, 'status'=>1)); ++$this->pass('pre-nodecreation'); ++ $node1 = $this->drupalCreateNode(array('title'=>'Private node 1','uid' => $this->admin_user->id(), 'status' => 0)); ++ $node1 = $this->drupalCreateNode(array('title'=>'Private node 1','private'=> TRUE, 'uid' => $this->admin_user->id(), 'status' => 0)); ++ ++ $value = $field_data[0]['value'] = $node1->id(); ++ $node2 = $this->drupalCreateNode(array('title' => 'Public node 2', $this->field_name => $field_data, 'private' => TRUE, 'uid' => $this->user->id(), 'status' => 1)); ++ $node3 = $this->drupalCreateNode(array('title' => 'Public node 3', 'private' => TRUE, 'uid' => $this->user->id(), 'status' => 1)); ++ $value2 = $field_data[0]['value'] = $node3->id(); ++ $node4 = $this->drupalCreateNode(array('title' => 'Public node 4', $this->field_name => $field_data, 'private' => TRUE, 'uid' => $this->user->id(), 'status' => 1)); ++ $node5 = $this->drupalCreateNode(array('title' => 'Public node 5', 'uid' => $this->user->id(), 'private' => FALSE, 'status' => 1)); ++$this->pass('post-nodecreation'); + + // @see http://drupal.org/node/1349080 + // Results we expect: @@ -173,7 +179,7 @@ + $this->private_nids = array(1); + + // Set up template query. -+ $join_table = _field_sql_storage_tablename($this->field); ++ $join_table = FieldableDatabaseStorageController::_fieldTableName($this->field); + $join_column = $this->field_name . '_value'; + + // Get Query object for query. @@ -216,7 +222,7 @@ + $this->assertUserResultAccess($tagged); + + // Add a second value to the original node, which the user CAN see: -+ $node2->{$this->field_name}[$langcode][] = array('value' => $node3->nid); ++ $node2->{$this->field_name}[$langcode][] = array('value' => $node3->id()); + $node2->save(); + // We now expect the admin user to have 2 rows for node 2. + $expected_admin_count++; // 6