webform_remote_post.test in Webform Remote Post 7
File
tests/webform_remote_post.test
View source
<?php
class WebformRemotePostTestCase extends DrupalWebTestCase {
protected $privileged_user;
public static function getInfo() {
return array(
'name' => 'Webform Remote Post Target',
'description' => 'Can create a Webform and add a Webform Remote Post target to it.',
'group' => 'Webform Remote Post',
);
}
public function setUp() {
parent::setUp(array(
'webform_remote_post',
));
$this->privileged_user = $this
->drupalCreateUser(array(
'access content',
'create webform content',
'edit own webform content',
'admin webform remote posts',
));
$this
->drupalLogin($this->privileged_user);
}
public function testCanAddATarget() {
$this
->drupalGet('node/add/webform');
$edit = array();
$edit['title'] = 'Sample Webform';
$this
->drupalPost('node/add/webform', $edit, t('Save'));
$this
->assertText(t('Webform Sample Webform has been created.'));
echo $this
->drupalGetContent();
$this
->clickLink(t('Remote Posts'));
$this
->assertText(t('No remote target URLs specified yet.'));
$edit = array(
'add[label]' => 'Request Bin',
'add[url]' => 'http://requestb.in/1i7x5vo1',
);
$this
->drupalPost(null, $edit, t('Add'));
$this
->assertText('Edit remote post settings');
$this
->drupalPost(null, array(), t('Save remote post settings'));
$this
->assertText('Request Bin');
$this
->assertText('http://requestb.in/1i7x5vo1');
}
}