I'm attaching a test for the issue #2007746: use hook_field_access() to hide fields of exiting entities. In the test i'm change the prepopoulate settings every time and saving the node and verify the reference remained.

Do we need to the check the fallback behavior? i'm just checking how to action settings effects on the node when saving him.

Comments

Status: Needs review » Needs work

The last submitted patch, hook-field-access-test.patch, failed testing.

amitaibu’s picture

+++ b/entityreference_prepopulate.testundefined
@@ -65,3 +65,116 @@ class EntityReferenceOgContextTestCase extends DrupalWebTestCase {
+      'name' => 'Entity reference reference remain',

=> Prepopulate

+++ b/entityreference_prepopulate.testundefined
@@ -65,3 +65,116 @@ class EntityReferenceOgContextTestCase extends DrupalWebTestCase {
+    parent::setUp(array('entityreference'));

Enable entityreference_prepopulate

+++ b/entityreference_prepopulate.testundefined
@@ -65,3 +65,116 @@ class EntityReferenceOgContextTestCase extends DrupalWebTestCase {
+    if (!field_info_field('node_ref')) {

Remove.

+++ b/entityreference_prepopulate.testundefined
@@ -65,3 +65,116 @@ class EntityReferenceOgContextTestCase extends DrupalWebTestCase {
+    if (!field_info_instance('node', 'node_ref', $content_type->type)) {

Remove.

amitaibu’s picture

And add the actual prepopulate test.

roysegall’s picture

Status: Needs work » Needs review
StatusFileSize
new4.76 KB

Attaching a patch with the fixes.

roysegall’s picture

StatusFileSize
new5.77 KB

Adding more scenarios when creating the node.

Status: Needs review » Needs work

The last submitted patch, hook-field-access-test-2026225-5.patch, failed testing.

roysegall’s picture

Status: Needs work » Needs review
StatusFileSize
new5.74 KB
amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.