public function MobileToolsDeviceGroupTestCase::testNewDeviceGroupCrud in Mobile Tools 7.3
Tests the ability to create, edit, and then delete a device group. Further tests that the default device group can be edited and reverted.
File
- ./
mobile_tools.test, line 138 - Tests for mobile tools
Class
Code
public function testNewDeviceGroupCrud() {
$this
->drupalLogin($this->admin_user);
// Test adding new device group
// Get add device group form
$this
->drupalGet($this->addUrl);
$this
->assertText('Device Group Name', t('Found device group form.'));
$form = $this->device_group;
// Submit new device group
$this
->drupalPost($this->addUrl, $form, t('Save device group'));
$this
->assertText($this->device_group['title']);
$this
->assertText($this->device_group['dgid']);
$this
->assertText($this->device_group['purl_modifier']);
$this
->assertText($this->device_group['theme']);
$this
->assertText($this->device_group['description']);
$this
->assertLinkByHref($this->editUrl . '/test_group', 0, t('Edit link found.'));
$this
->assertLinkByHref($this->deleteUrl . '/test_group', 0, t('Delete link found.'));
// Test editing device group
// Get edit device group form
$this
->drupalGet($this->editUrl . '/test_group');
$this
->assertFieldByName('title', 'Test Group', t('Found title field.'));
$this
->assertFieldByName('dgid', 'test_group', t('Found machine-name field.'));
$this
->assertFieldByName('purl_modifier', 'test_modifier', t('Found PURL modifier field.'));
$this
->assertOptionSelected('edit-theme', 'bartik', t('Found theme option.'));
$this
->assertFieldByName('description', 'Test device group.', t('Found description field.'));
$form = $this->renamed_device_group;
// Submit edited device group
$this
->drupalPost($this->editUrl . '/test_group', $form, t('Save device group'));
$this
->assertText($this->renamed_device_group['title']);
$this
->assertText($this->device_group['dgid']);
$this
->assertText($this->renamed_device_group['purl_modifier']);
$this
->assertText($this->renamed_device_group['theme']);
$this
->assertText($this->renamed_device_group['description']);
$this
->assertLinkByHref($this->editUrl . '/test_group', 0, t('Edit link found.'));
$this
->assertLinkByHref($this->deleteUrl . '/test_group', 0, t('Delete link found.'));
// Test deleting device group
// Get delete device group form
$this
->drupalGet($this->deleteUrl . '/test_group');
$this
->assertText('Are you sure you want to delete the device group ' . $form['title']);
$form = array(
'confirm' => 1,
);
// Confirm deletion of device group
$this
->drupalPost($this->deleteUrl . '/test_group', $form, t('Delete'));
$this
->assertText('Device group test_group has been deleted.');
$this
->assertNoText($this->renamed_device_group['title']);
// */
}