You are here

public function DomainTestCase::domainNodeForm in Domain Access 7.3

Helper function for form introspection.

Forms are sensitive to the global user account, so we must reset it when using this technique.

Parameters

$uid: A user id representing the account to test.

$type: The node type of the form.

2 calls to DomainTestCase::domainNodeForm()
DomainSettingsTest::testDomainContentSettings in tests/domain.test
DomainSourceTest::testDomainSourceForm in domain_source/tests/domain_source.test

File

tests/domain.test, line 106
Simpletest for Domain Access.

Class

DomainTestCase
@file Simpletest for Domain Access.

Code

public function domainNodeForm($uid, $type) {
  $temp = $GLOBALS['user'];
  $user = user_load($uid, TRUE);
  $GLOBALS['user'] = $user;
  $node = (object) array(
    'uid' => $user->uid,
    'name' => isset($user->name) ? $user->name : '',
    'type' => $type,
    'language' => LANGUAGE_NONE,
  );
  module_load_include('inc', 'node', 'node.pages');
  $form = drupal_get_form($type . '_node_form', $node);
  $GLOBALS['user'] = $temp;
  return $form;
}