function NotificationsCustomTests::createCustomSubscription in Notifications 7
Same name and namespace in other branches
- 6.4 tests/notifications_custom.test \NotificationsCustomTests::createCustomSubscription()
Create custom subscription through admin form
1 call to NotificationsCustomTests::createCustomSubscription()
File
- tests/
notifications_custom.test, line 76
Class
Code
function createCustomSubscription($data, $fields = array()) {
$data += array(
'newtype' => 'custom_' . $this
->randomName(10),
'title' => $this
->randomName(20),
'name' => $this
->randomName(40),
'description' => $this
->randomName(80),
);
foreach ($data as $field => $value) {
$edit["subscription[{$field}]"] = $value;
}
$this
->drupalPost('admin/messaging/customsubs/new', $edit, t('Save'));
$this
->assertText('The subscription type has been created.');
$subscription = notifications_custom_load($data['newtype']);
$this
->assertTrue($subscription, 'A new custom subscription type has been created');
if ($fields) {
$subscription = $this
->createCustomFields($subscription, $fields);
}
return $subscription;
}