function SmsActionWebTest::testSmsActionsCommandCrud in SMS Framework 7
Tests user adding phone number.
File
- modules/
sms_actions/ sms_actions.test, line 36 - Contains tests for the functions in sms_action.module and actions integration.
Class
- SmsActionWebTest
- Provides integration tests for the sms_action module.
Code
function testSmsActionsCommandCrud() {
$user = $this
->drupalCreateUser(array(
'administer smsframework',
));
$this
->drupalLogin($user);
// Get the command listing page.
$this
->drupalGet('admin/smsframework/actions');
$this
->assertResponse(200);
$this
->assertRaw('SMS Actions');
$this
->assertRaw('<th>Discriminator</th>', '"Discriminator" column found.');
$this
->assertRaw('<th>Operations</th>', '"Operations" column found');
$this
->assertRaw('No commands available.');
// Add a new command.
$this
->drupalPost('admin/smsframework/actions/add', $edit = array(
'discriminator' => 'test-machinename',
), t('Save command'));
$this
->assertRaw('<td>test-machinename</td>', 'Action saved.');
// Add a new command that will fail validation.
$this
->drupalPost('admin/smsframework/actions/add', array(
'discriminator' => 'test-machine-name',
), t('Save command'));
$this
->assertNoRaw('<td>test-machine-name</td>', 'Invalid action name not saved.');
// Change the name.
$this
->drupalPost('admin/smsframework/actions/edit/test-machinename', $edit = array(
'discriminator' => 'machinename',
), t('Save command'));
$this
->assertRaw('<td>machinename</td>', 'Action name changed.');
}