Skip to content

Commit

Permalink
Merge pull request #5 from herbdool/1.x-1.x
Browse files Browse the repository at this point in the history
Fixes for issues #3 and #4 and #2
  • Loading branch information
herbdool committed Jan 19, 2016
2 parents 83bc514 + 4458f6b commit 292eceb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion node_reference/node_reference.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description = Defines a field type for referencing one node from another.
package = Fields
core = 7.x
backdrop = 1.x
type = module
dependencies[] = field
dependencies[] = references
dependencies[] = options
files[] = node_reference.test
17 changes: 15 additions & 2 deletions node_reference/node_reference.install
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,22 @@ function node_reference_field_schema($field) {
}

/**
* Rebuild views data cache (a callabck was renamed).
* Implements hook_update_last_removed().
*/
function node_reference_update_7000() {
function node_reference_update_last_removed() {
return 7000;
}

/**
* @defgroup updates-7.x-to-1.x Updates from 7.x to 1.x
* @{
* Update functions from Drupal 7.x to Backdrop CMS 1.x.
*/

/**
* Rebuild views data cache (a callback was renamed).
*/
function node_reference_update_1000() {
if (function_exists('views_invalidate_cache')) {
views_invalidate_cache();
}
Expand Down
18 changes: 10 additions & 8 deletions node_reference/tests/node_reference.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Unit tests for referenceability of node types in entity forms.
*/
require_once BACKDROP_ROOT . '/core/modules/field/tests/field.test';

class NodeReferenceFormTest extends FieldTestCase {
public static function getInfo() {
return array(
Expand Down Expand Up @@ -104,14 +106,14 @@ class NodeReferenceFormTest extends FieldTestCase {
*/
function testLongNodeReferenceWidget() {
// Create regular test user.
$web_user = $this->backdropCreateUser(array('create article content', 'access content'));
$web_user = $this->backdropCreateUser(array('create post content', 'access content'));
$this->backdropLogin($web_user);

// Create test field instance on article node type.
// Create test field instance on post node type.
$instance = array(
'field_name' => $this->field_name,
'entity_type' => 'node',
'bundle' => 'article',
'bundle' => 'post',
'widget' => array(
'type' => 'node_reference_autocomplete',
),
Expand All @@ -131,25 +133,25 @@ class NodeReferenceFormTest extends FieldTestCase {

// Display node creation form.
$langcode = LANGUAGE_NONE;
$this->backdropGet('node/add/article');
$this->backdropGet('node/add/post');
$this->assertFieldByName("{$this->field_name}[$langcode][0][nid]", '', t('Widget is displayed'));

// Submit node form with autocomplete value for short title.
$edit = array(
'title' => $this->randomName(8),
"{$this->field_name}[$langcode][0][nid]" => $node_short_title->title . ' [nid:' . $node_short_title->nid . ']',
);
$this->backdropPost('node/add/article', $edit, t('Save'));
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Article', '%title' => $edit["title"])), t('Article created.'));
$this->backdropPost('node/add/post', $edit, t('Save'));
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Post', '%title' => $edit["title"])), t('Post created.'));
$this->assertText($node_short_title->title, t('Referenced node title is displayed.'));

// Submit node form with autocomplete value for long title.
$edit = array(
'title' => $this->randomName(8),
"{$this->field_name}[$langcode][0][nid]" => $node_long_title->title . ' [nid:' . $node_long_title->nid . ']',
);
$this->backdropPost('node/add/article', $edit, t('Save'));
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Article', '%title' => $edit["title"])), t('Article created.'));
$this->backdropPost('node/add/post', $edit, t('Save'));
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Post', '%title' => $edit["title"])), t('Post created.'));
$this->assertText($node_long_title->title, t('Referenced node title is displayed.'));
}
}
1 change: 1 addition & 0 deletions references.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description = Defines common base features for the various reference field types
package = Fields
core = 7.x
backdrop = 1.x
type = module
dependencies[] = field
dependencies[] = options
files[] = views/references_handler_relationship.inc
Expand Down
1 change: 1 addition & 0 deletions references_uuid/references_uuid.info
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name = References UUID
core = 7.x
backdrop = 1.x
type = module
package = Fields
dependencies[] = references
dependencies[] = uuid
1 change: 1 addition & 0 deletions user_reference/user_reference.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description = Defines a field type for referencing a user from a node.
package = Fields
core = 7.x
backdrop = 1.x
type = module
dependencies[] = field
dependencies[] = references
dependencies[] = options

0 comments on commit 292eceb

Please sign in to comment.