public static function WebformTest::nodeStub in Little helpers 7.2
Same name and namespace in other branches
- 7 tests/Webform/WebformTest.php \Drupal\little_helpers\Test\Webform\WebformTest::nodeStub()
Create a node stub.
2 calls to WebformTest::nodeStub()
- WebformTest::testComponentReturnsComponentArray in tests/
Webform/ WebformTest.php - Test getting components by component ID.
- WebformTest::testComponentReturnsNullForUnknownComponent in tests/
Webform/ WebformTest.php - Test getting an unknown component.
File
- tests/
Webform/ WebformTest.php, line 16
Class
- WebformTest
- Test the webform node wrapper.
Namespace
Drupal\little_helpers\Test\WebformCode
public static function nodeStub() {
$webform['redirect_url'] = 'node/167';
$webform['components'][1] = array(
'cid' => '1',
'form_key' => 'first_name',
'name' => 'First name',
'type' => 'textfield',
'value' => '%get[p3]',
'extra' => array(),
);
$webform['components'][2] = array(
'cid' => '2',
'form_key' => 'last_name',
'name' => 'Last name',
'type' => 'textfield',
'value' => '%get[p4]',
'extra' => array(),
);
$webform['components'][3] = array(
'cid' => '3',
'pid' => '0',
'form_key' => 'email',
'name' => 'Mail ',
'type' => 'email',
'value' => '%get[p5]',
'extra' => array(),
);
$webform['components'][4] = array(
'cid' => '4',
'pid' => '0',
'form_key' => 'your_message',
'name' => 'Your message',
'type' => 'fieldset',
'value' => '',
'extra' => array(),
);
$webform['components'][6] = array(
'cid' => '6',
'pid' => '4',
'form_key' => 'email_subject',
'name' => 'Subject',
'type' => 'textfield',
'value' => 'subject default value',
'extra' => array(),
);
$webform['components'][7] = array(
'cid' => '7',
'pid' => '4',
'form_key' => 'email_body',
'name' => 'Your email',
'type' => 'textarea',
'value' => 'body default value',
'extra' => array(),
);
return (object) array(
'webform' => $webform,
);
}